Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when implementing crash reporting, capturing fatal/non-fatal errors, recording isolate/async exceptions, customizing reports, or uploading obfuscated symbols.
.claude/skills/evanca-firebase-crashlytics/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 13% | 0% |
| case-04 | ✗→✓ | ▲ Improved | -12% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 21% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 33% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 18% | 0% |
This skill defines how to correctly use Firebase Crashlytics in Flutter applications.
Use this skill when:
flutter pub add firebase_crashlytics
flutter pub add firebase_analytics # enables breadcrumb logs for better crash contextRun flutterfire configure to update the Firebase configuration and add the required Crashlytics Gradle plugin for Android.
dartimport 'package:firebase_crashlytics/firebase_crashlytics.dart';
Obfuscated code:
--split-debug-info and/or --obfuscate, upload symbol files for readable stack traces.bashfirebase crashlytics:symbols:upload --app=FIREBASE_APP_ID PATH/TO/symbols
Configure comprehensive error capture in main() to catch errors from all sources:
Fatal Flutter errors:
dartvoid 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:
dartIsolate.current.addErrorListener(RawReceivePort((pair) async { final List<dynamic> errorAndStacktrace = pair; await FirebaseCrashlytics.instance.recordError( errorAndStacktrace.first, errorAndStacktrace.last, fatal: true, ); }).sendPort);
Caught exceptions (non-fatal):
dartawait FirebaseCrashlytics.instance.recordError( error, stackTrace, reason: 'a non-fatal error', information: ['further diagnostic information about the error', 'version 2.0'], );
Custom keys (max 64 key/value pairs, up to 1 kB each):
dartFirebaseCrashlytics.instance.setCustomKey('str_key', 'hello'); FirebaseCrashlytics.instance.setCustomKey('bool_key', true); FirebaseCrashlytics.instance.setCustomKey('int_key', 1);
Custom log messages (limit: 64 kB per session):
dartFirebaseCrashlytics.instance.log("User tapped on payment button");
User identifier:
dartFirebaseCrashlytics.instance.setUserIdentifier("user-123"); // Clear by setting to blank string FirebaseCrashlytics.instance.setUserIdentifier("");
Disable Crashlytics in debug builds:
dartif (kReleaseMode) { await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true); } else { await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(false); }
Force a test crash to verify the setup:
dartFirebaseCrashlytics.instance.crash();
Verification workflow:
By default, Crashlytics automatically collects crash reports for all users.
To give users control over data collection:
setCrashlyticsCollectionEnabled(true) when users opt in.false — this applies from the next app launch.Other measured skills in the registry, with their headline benchmark lift.