New Crashlytics Crash Reporting APIs (#1351)

* Changes to package import statements

Without these changes to the package import statements, if a user uncomments the FirebaseCrashlytics code, they will get a bunch of errors.

* Commented out import statements & added instructions

* Update crashlytics.dart

Upgrade Crashlytics.dart to use recently released fatal crash APIs
https://firebase.blog/posts/2022/07/whats-new-in-crashlytics-for-flutter

* Ran dart format on changed files
pull/1352/head
Rich Hall 3 years ago committed by GitHub
parent 1594d74199
commit 1de97a68d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -40,14 +40,15 @@ Future<void> guardWithCrashlytics(
crashlytics?.log(message);
if (record.level >= Level.SEVERE) {
crashlytics?.recordError(message, filterStackTrace(StackTrace.current));
crashlytics?.recordError(message, filterStackTrace(StackTrace.current),
fatal: true);
}
});
// Pass all uncaught errors from the framework to Crashlytics.
if (crashlytics != null) {
WidgetsFlutterBinding.ensureInitialized();
FlutterError.onError = crashlytics.recordFlutterError;
FlutterError.onError = crashlytics.recordFlutterFatalError;
}
if (!kIsWeb) {
@ -56,9 +57,8 @@ Future<void> guardWithCrashlytics(
Isolate.current.addErrorListener(RawReceivePort((dynamic pair) async {
final errorAndStacktrace = pair as List<dynamic>;
await crashlytics?.recordError(
errorAndStacktrace.first,
errorAndStacktrace.last as StackTrace?,
);
errorAndStacktrace.first, errorAndStacktrace.last as StackTrace?,
fatal: true);
}).sendPort);
}
@ -68,7 +68,7 @@ Future<void> guardWithCrashlytics(
// This sees all errors that occur in the runZonedGuarded zone.
debugPrint('ERROR: $error\n\n'
'STACK:$stack');
crashlytics?.recordError(error, stack);
crashlytics?.recordError(error, stack, fatal: true);
});
}

Loading…
Cancel
Save