Skip to content

Instantly share code, notes, and snippets.

@abbath0767
Last active December 5, 2018 14:33
Show Gist options
  • Save abbath0767/3c372b27b641263b9366583bd56a41f4 to your computer and use it in GitHub Desktop.
Save abbath0767/3c372b27b641263b9366583bd56a41f4 to your computer and use it in GitHub Desktop.
class TestWidget extends StatefulWidget{
@override
State<StatefulWidget> createState() => TestState();
}
class TestState extends State<TestWidget> {
String _text;
@override
Widget build(BuildContext context) {
if (_text == null)
_text = "Empty";
return Text(_text);
}
void updateText(String newText) {
setState(() {
this._text = newText;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment