Reputation: 239
We are using firebase_crashlytics: ^0.4.0+1
in a flutter app. Within the runApp() we are starting to listen to errors and crashes just like mentioned in the documentation.
runZonedGuarded(() {
runApp(
..
}, (error, stackTrace) {
FirebaseCrashlytics.instance.recordError(error, stackTrace);
});
In general crashes are reported, but not for these type of crashes EXCEPTION CAUGHT BY WIDGETS LIBRARY. In some circumstances objects might be null, but instead of getting a crash reported to the firebase crashlytics dashboard, nothing happens. User only receive a grey screen and that is it. Therefore we only are notified if a user reports these errors, but we receive no logs. Is this a non-fatal error and we should be using recordFlutterError method?
BTW, this is being called when the error is thrown:
Function originalOnError = FlutterError.onError;
FlutterError.onError = (FlutterErrorDetails errorDetails) async {
await FirebaseCrashlytics.instance.recordFlutterError(errorDetails);
// Forward to original handler.
originalOnError(errorDetails);
Even the method originalOnError(errorDetails)
is called the error is not recorded in the firebase crashlytics dashboard.
How can we make these non-fatal errors also be reported?
Upvotes: 4
Views: 4251
Reputation: 368
If you want to record non-fatal error log in your app. In my case i used it as logging all the request other then 200 from server. you can use like this as well.
For this you can use just this after all the configurations
FirebaseCrashlytics.instance.log('Here is My custom Error for it ');
Upvotes: 0
Reputation: 239
The logging has been done by firebase crashlytics. The default filter in the firebase console dashboard was set to crashes
. Removing the filter and we can see all reported errors, crashes, non-fatal errors.
Thanks to this stackoverflow post
Upvotes: 3