flutterfire
flutterfire copied to clipboard
[📚] Crashlytics recordFlutterFatalError
Hello, on the new documentation of crashlytics https://firebase.google.com/docs/crashlytics/get-started it is written to use
FlutterError.onError = FirebaseCrashlytics.instance.**recordFlutterFatalError**;
instead on https://pub.dev/packages/firebase_crashlytics it is written to use
FlutterError.onError = FirebaseCrashlytics.instance.**recordFlutterError**;
I always used the second one but on the new documentation it use recordFlutterFatalError and this is causing me a lot of trouble on the crashlytics dashboard because every error is marked as a crash.
Why then? Thank you
I came here to ask this very question.
We recently upgraded our various FlutterFire plugins, changed our implementation to match the new documentation and now everything is being logged as fatal.
My main.dart looks like this:
void main() async {
await runZonedGuarded(() async {
// Initialise Firebase before rendering the app, see: https://firebase.flutter.dev/docs/overview/#initializing-flutterfire
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
// Error logging
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;
Isolate.current.addErrorListener(RawReceivePort((pair) async {
final List<dynamic> errorAndStacktrace = pair;
await FirebaseCrashlytics.instance.recordError(
errorAndStacktrace.first,
errorAndStacktrace.last,
);
}).sendPort);
// Get cracking
runApp(MyApp());
}, (error, stack) {
FirebaseCrashlytics.instance.recordError(error, stack, fatal: true);
});
}
Possibly related: #8779
My
main.dartlooks like this:
@oodavid is
Isolate.current.addErrorListener(RawReceivePort((pair) async {
final List<dynamic> errorAndStacktrace = pair;
await FirebaseCrashlytics.instance.recordError(
errorAndStacktrace.first,
errorAndStacktrace.last,
);
}).sendPort);
Actually working for you?
I'm getting compilation errors -

Having the same issue, I might switch back to recordFlutterError since I do not want the errors marked as crashes