Firebase Crashlytics — Flutter 💙💛

Who will use an app with crashes? How will you be able to know the crashes faced by your users? It’s always good to integrate a crash reporting tool!

Abhishek Doshi
Google Developer Experts
2 min readNov 23, 2022


Even if we try to make our app crash-free, no one knows when your app will crash 🤯

There’s nothing like perfect, crash-free code!

So, to keep ourselves safe from banging our heads over tracking bugs and crashes, integrating any crash reporting tools with your application is always a good idea.

Firebase Crashlytics is one such tool provided by Firebase. Its integration is straightforward, and the crashes reported are the same as we see while debugging the app, making it easier for us to track and solve them!

Step 1: Enable Crashlytics

Go to Firebase Console and in the left panel, under Release & Monitor , go to Crashlytics and click on Add SDK button.

Step 2: Add Crashlytics SDK to your project

Add firebase_crashlytics to your pubspec.yaml file and run flutter pub get. The next step is to run flutterfire configure so that your Flutter app’s Firebase configuration is up-to-date and, for Android, it adds the required Crashlytics Gradle plugin to your app.

Step 3: Add crash logging code

So, we don’t know when and where the crash will occur. We need to find a way which will allow us to catch all the unhandled exceptions! Flutter SDK has blessed us with a great method for it 🥳

You can automatically catch all errors that are thrown within the Flutter framework by overriding FlutterError.onError with FirebaseCrashlytics.instance.recordFlutterFatalError:

void main() async {
runZonedGuarded<Future<void>>(() async {
await Firebase.initializeApp();

FlutterError.onError =

}, (error, stack) =>
FirebaseCrashlytics.instance.recordError(error, stack, fatal: true));

Now, that’s all we need to log any crashes or exceptions that might break your head for solving 😉

Hope you enjoyed this article!

Doubts? Feel free to drop a message @AbhishekDoshi26

Don’t stop, until you are breathing!💙
- Abhishek Doshi



Abhishek Doshi
Google Developer Experts

Google Developer Expert — Dart, Flutter & Firebase 💙💛