As a brief note, sometimes in Flutter (and Dart) you have to write a method/function that makes an asynchronous call, but the method can’t be marked async itself. The Flutter initState method is a good example of this.
So far I’ve learned two ways to deal with this:
- Use
theninside the non-async method - Use an unusual anonymous-function style syntax inside the method
I’ll demonstrate each technique below.