Skip to content

Instantly share code, notes, and snippets.

@piumimaheshika
Last active January 7, 2021 07:34
Show Gist options
  • Select an option

  • Save piumimaheshika/ad37019f04854885b33d44d4b4983cf3 to your computer and use it in GitHub Desktop.

Select an option

Save piumimaheshika/ad37019f04854885b33d44d4b4983cf3 to your computer and use it in GitHub Desktop.
Crashlytics flutter
//Record non fatal errors
Future<void> reportNonFatalError(String error, String method, String reason,
{dynamic exception, StackTrace stack}) async {
FirebaseCrashlytics.instance.setCustomKey('ERROR', error);
FirebaseCrashlytics.instance.setCustomKey('METHOD', method);
FirebaseCrashlytics.instance.setCustomKey('REASON', reason);
FirebaseCrashlytics.instance.log(reason);
await FirebaseCrashlytics.instance.recordError(
exception != null ? exception : Error(),
stack != null ? stack : StackTrace.current,
reason: 'Recorded error');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment