Last active
June 3, 2019 22:52
-
-
Save rapPayne/c77adb98cb8c7749a205ae04fabf13bd to your computer and use it in GitHub Desktop.
To get a value out of an async callback, you set an external variable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class FooState extends State<FooComponent> { | |
| String _firstName; // <-- A variable known by the whole class | |
| Widget build(BuildContext context) { | |
| // return a widget | |
| } | |
| void _myCallback(String someVar) { | |
| _firstName = someVar; // <-- Getting a value OUT of an async callback | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment