How to add initial Value in TextField

To add initial value in TextField, Flutter provides TextEditingController class to handle TextField Values. If you want to get value from TextField, Just write this code :

String value = _controller.text;

to set initial value in TextField :

_controller.text = "Hello There";
TextFormField(
          controller: _controller,
),
Share

You may also like...

1 Response

  1. Kishan Mevada says:

    It’s very helpful

Leave a Reply

Your email address will not be published. Required fields are marked *