# Firebase Crashlytics

Use when implementing crash reporting, capturing fatal/non-fatal errors, recording...

- Repository: https://github.com/evanca/flutter-ai-rules (668 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add evanca/flutter-ai-rules --skill firebase-crashlytics -g -a claude-code -y`
Codex: `npx skills add evanca/flutter-ai-rules --skill firebase-crashlytics -g -a codex -y`
Cursor: `npx skills add evanca/flutter-ai-rules --skill firebase-crashlytics -g -a cursor -y`
Gemini CLI: `npx skills add evanca/flutter-ai-rules --skill firebase-crashlytics -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add evanca/flutter-ai-rules`

## Description

Use when implementing crash reporting, capturing fatal/non-fatal errors, recording isolate/async exceptions, customizing reports, or uploading obfuscated symbols.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Firebase Crashlytics Skill

This skill defines how to correctly use Firebase Crashlytics in Flutter applications.

## When to Use

Use this skill when:

* Implementing crash reporting in a Flutter project.
* Capturing fatal errors, non-fatal exceptions, and async/isolate errors.
* Customizing crash reports with keys, logs, and user identifiers.
* Configuring opt-in data collection or disabling reporting in debug builds.
* Uploading symbol files for obfuscated builds.

---

## 1. Setup and Configuration

```
flutter pub add firebase_crashlytics
flutter pub add firebase_analytics  # enables breadcrumb logs for better crash context
```

Run `flutterfire configure` to update the Firebase configuration and add the required Crashlytics Gradle plugin for Android.

```dart
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
```

**Obfuscated code:**
- For apps built with `--split-debug-info` and/or `--obfuscate`, upload symbol files for readable stack traces.
- **iOS:** Flutter 3.12.0+ and Crashlytics Flutter plugin 3.3.4+ handle symbol upload automatically.
- **Android:** Use Firebase CLI (v11.9.0+) to upload Flutter debug symbols:

```bash
firebase crashlytics:symbols:upload --app=FIREBASE_APP_ID PATH/TO/symbols
```

---

## 2. Error Handling

Configure comprehensive error capture in `main()` to catch errors from all sources:

**Fatal Flutter errors:**

```dart
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();

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

  // Catch async errors not handled by the Flutter framework
  PlatformDispatcher.instance.onError = (error, stack) {
    FirebaseCrashlytics.instance.recordError(error, stack, fatal: true);
    return true;
  };

  runApp(MyApp());
}
```

**Non-fatal Flutter errors:** use `recordFlutterError` instead of `recordFlutterFatalError`.

**Isolate errors:**

The rest: https://github.com/evanca/flutter-ai-rules/blob/HEAD/skills/firebase-crashlytics/SKILL.md
