-1

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

 TextField(
     textFieldData=readDataTurnString();
                keyboardType: TextInputType.emailAddress,
                textAlign: TextAlign.center,
                onChanged: (value) {},
                decoration: InputDecoration(hintText: 'Enter Your Public Key'),

              ),
johnzengin
  • 23
  • 4

1 Answers1

3

You are do something like following:

TextEditingController _controller = new TextEditingController();

@override
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?

Bagghi Daku
  • 652
  • 10
  • 15