Flutter listening to textField value changes from other widget. You just have to listen the TextEditingController for text changes.
Here is example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | var _textController = TextEditingController(); @override void dispose() { // Clean up the controller when the Widget is disposed _textController.dispose(); super.dispose(); } @override void initState() { _textController.addListener((){ //here you have the changes of your textfield print("value: ${_textController.text}"); //use setState to rebuild the widget setState(() { }); }); super.initState(); } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.