firebase_crashlytics 0.1.4+1

Flutter Android iOS

Flutter plugin for Firebase Crashlytics. It reports uncaught errors to the Firebase console.

firebase_crashlytics plugin #

A Flutter plugin to use the Firebase Crashlytics Service.

pub package

For Flutter plugins for other Firebase products, see

Usage #

Import the firebase_crashlytics plugin #

To use the firebase_crashlytics plugin, follow the plugin installation instructions.

Android integration #

Enable the Google services by configuring the Gradle scripts as such:

  1. Add the Fabric repository to the [project]/android/build.gradle file.
repositories {
  // Additional repository for fabric resources
  maven {
    url ''
  1. Add the following classpaths to the [project]/android/build.gradle file.
dependencies {
  // Example existing classpath
  classpath ''
  // Add the google services classpath
  classpath ''
  // Add fabric classpath
  classpath ''
  1. Apply the following plugins in the [project]/android/app/build.gradle file.
apply plugin: 'io.fabric'
apply plugin: ''

Note: If this section is not completed, you will get an error like this:

Default FirebaseApp is not initialized in this process [package name].
Make sure to call FirebaseApp.initializeApp(Context) first.

Note: When you are debugging on Android, use a device or AVD with Google Play services. Otherwise, you will not be able to use Firebase Crashlytics.

iOS Integration #

Add the Crashlytics run scripts:

  1. From Xcode select Runner from the project navigation.
  2. Select the Build Phases tab.
  3. Click + Add a new build phase, and select New Run Script Phase.
  4. Add ${PODS_ROOT}/Fabric/run to the Type a script... text box.
  5. If you are using Xcode 10, add the location of Info.plist, built by your app, to the Build Phase's Input Files field.

Use the plugin #

Add the following imports to your Dart code:

import 'package:firebase_crashlytics/firebase_crashlytics.dart';

Setup Crashlytics:

void main() {
  // Set `enableInDevMode` to true to see reports while in debug mode
  // This is only to be used for confirming that reports are being
  // submitted as expected. It is not intended to be used for everyday
  // development.
  Crashlytics.instance.enableInDevMode = true;

  // Pass all uncaught errors from the framework to Crashlytics.
  FlutterError.onError = Crashlytics.instance.recordFlutterError;

Overriding FlutterError.onError with Crashlytics.instance.recordFlutterError will automatically catch all errors that are thrown from within the Flutter framework.
If you want to catch errors that occur in runZoned, you can supply Crashlytics.instance.recordError to the onError parameter:

runZoned<Future<void>>(() async {
    // ...
  }, onError: Crashlytics.instance.recordError);

Finally, to catch errors that happen outside Flutter context, install an error listener on the current Isolate:

Isolate.current.addErrorListener(RawReceivePort((pair) async {
  final List<dynamic> errorAndStacktrace = pair;
  await Crashlytics.instance.recordError(

Result #

If an error is caught, you should see the following messages in your logs:

flutter: Flutter error caught by Crashlytics plugin:
// OR if you use recordError for runZoned:
flutter: Error caught by Crashlytics plugin <recordError>:
// Exception, context, information, and stack trace in debug mode
// OR if not in debug mode:
flutter: Error reported to Crashlytics.

Note: It may take awhile (up to 24 hours) before you will be able to see the logs appear in your Firebase console.

Example #

See the example application source for a complete sample app using firebase_crashlytics.

Issues and feedback #

Please file FlutterFire specific issues, bugs, or feature requests in our issue tracker.

Plugin issues that are not specific to Flutterfire can be filed in the Flutter issue tracker.

To contribute a change to this plugin, please review our contribution guide and open a pull request.

pub points


Flutter plugin for Firebase Crashlytics. It reports uncaught errors to the Firebase console.

Repository (GitHub)
View/report issues


API reference




flutter, stack_trace


Packages that depend on firebase_crashlytics