I'd like to supply an initial value to a text field and redraw it with an empty value to clear the text. What's the best approach to do that with Flutter's APIs?
Flutter – How to supply an initial value to a text field
dartfluttertextfield
dartfluttertextfield
I'd like to supply an initial value to a text field and redraw it with an empty value to clear the text. What's the best approach to do that with Flutter's APIs?
Best Answer
You can use a
TextFormField
instead ofTextField
, and use theinitialValue
property. for example