How can i send data to textfield in flutter


Hello i am reading a barcode and if the barcode reader i would like set up the input of the Textfield the the data that i read but i couldn’t figured out how to do that here is my code

                keyboardType: TextInputType.emailAddress,
                onChanged: (value) {},
                decoration: InputDecoration(hintText: 'Enter Your Public Key'),



You are do something like following:

TextEditingController _controller = new TextEditingController();

Widget build(BuildContext context) {
    child: TextField(controller: _controller),

You can later use the _controller to set the value of Textfield like this:

_controller.text = "New Text Value";

Does this solve your problem?

Answered By – Anuroop Singh

Answer Checked By – Cary Denson (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.