Flutter Crashlytics - No Crash log for non-fatal flutter error

1,302

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

Share:
1,302
stan
Author by

stan

Updated on December 06, 2022

Comments

  • stan
    stan over 1 year

    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?