Answers for "flutter how to get a value from text widget"

0

flutter how to get a value from text widget

String txt =  '';

@override
Widget build(BuildContext context) {
return Column(
	Children <Widget>[
    Text(txt), // this will store the text from somewhere and save it in to txt
    SizedBox(height: 15),
    ElevatedButton(
    onPressed () {
    // we can then call txt to see if the value is correct
    print(txt.tostring); //.tostring may not be necessary
    }
    ),
    ]
  ); 
}
Posted by: Guest on March-17-2021

Code answers related to "flutter how to get a value from text widget"

Code answers related to "Dart"

Browse Popular Code Answers by Language