how to return text from a widget flutter code example
Example: flutter how to get a value from text widget
String txt = '';
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
}
),
]
);
}