Skip to content

Instantly share code, notes, and snippets.

@madmag77
Created March 5, 2021 10:34
Show Gist options
  • Save madmag77/fd58e2ea2b21750d249ac817e60f41d3 to your computer and use it in GitHub Desktop.
Save madmag77/fd58e2ea2b21750d249ac817e60f41d3 to your computer and use it in GitHub Desktop.
[Dart article] Unhandled Exceptions in Flutter
void main() {
WidgetsFlutterBinding.ensureInitialized();
FlutterError.onError = (FlutterErrorDetails errorDetails) {
print("onError Exception: $errorDetails was caught by Flutter framework - redirect to Sentry or Firebase.");
};
runZonedGuarded(() {
createProviders();
runApp(MyApp());
}, (e, s) {
print(
"Synchronous or Asynchronous Exception: $e (stack $s) was caught in our custom zone - redirect to Sentry or Firebase.");
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment