Dont pass around BuildContext
for making snackbars
#292
Labels
chore
Something that is not a bug or a feature, does not change production behaviour
easy and fun
Good for newcomers
priority: low
Should be dealt with when nothing else remains.
What
Use a
GlobalKey<ScaffoldMessengerState>
instead of passing around aBuildContext
Why
BuildContext
can expire, and although it is possible to avoid using an expiredBuildContext
we don't know if the scaffold is still alive at the time of calling a snackbar.How
https://github.com/flutter/flutter/blob/master/examples/api/lib/material/scaffold/scaffold_messenger.of.1.dart
The text was updated successfully, but these errors were encountered: