How to catch and report exception caught by rendering library in Flutter?

Viewed 208

I would like to catch and report when UI exception occurs in app. I would like to report it with firebase tools or save in local activity log, but I don't know where to catch it?

1 Answers

Crashlytics has a way of doing it. It has a way of listening to Flutter Errors and will record it on Firebase:

FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;

You can also replace the FirebaseCrashlytics.instance.recordFlutterError with whatever your service you want to use.

FlutterError.onError = //whatever service you use.
Related