Skip to content

Instantly share code, notes, and snippets.

@Vanethos
Created January 13, 2020 08:19
Show Gist options
  • Save Vanethos/4d14255cf65ada3792295b388fa0f05e to your computer and use it in GitHub Desktop.
Save Vanethos/4d14255cf65ada3792295b388fa0f05e to your computer and use it in GitHub Desktop.
void main_common() async {
//...
runZoned<Future<Null>>(() async {
runApp(CrashyApp());
}, onError: (error, stackTrace) async {
// Since the state can be null, we use `?.` to verify if it is null. If it is null, we don't do anything, if it is NOT null, we call the `push` function on it
navigatorKey.currentState?.push(
MaterialPageRoute(builder: (_) => ErrorWidget(),
));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment