groveman_crashlytics 1.1.0 copy "groveman_crashlytics: ^1.1.0" to clipboard
groveman_crashlytics: ^1.1.0 copied to clipboard

Groveman tree that sends its logs to Firebase Crashlytics through recordError and logs.

Groveman Crashlytics #

pub License: MIT groveman_crashlytics codecov

Tree for the groveman.

It sends your logs to the Firebase Crashlytics.

Usage #

First, configure the Firebase Crashlytics, for it, see the documentation.

By default, if use Groveman.captureErrorInCurrentIsolate, its log level is fatal, this is configurable.

Groveman.captureErrorInCurrentIsolate(logLevel: LogLevel.error);

Add it in your pubspec.yaml:

dependencies:
  // Only to send the fatal log levels
  firebase_analytics:
  groveman:
  groveman_crashlytics:

Import it where you want to use it e.g, in your main file.

import 'package:groveman/groveman.dart';
import 'package:groveman_crashlytics/groveman_crashlytics.dart';

Initialize crashlytics tree on start of your application.

void main() {  
  Groveman.plantTree(DebugTree());
  Groveman.captureErrorInZone(() async {
    WidgetsFlutterBinding.ensureInitialized();
    await Firebase.initializeApp();
    if (kReleaseMode) {
      Groveman.plantTree(CrashlyticsTree());
    }
    Groveman.captureErrorInCurrentIsolate();
    runApp(const MyApp());
  });
}

Usually, you only send your logs in production.

By default, the log levels info, warning, error, and fatal are sent to Crashlytics.

Groveman.error(message, error: exception);

If the LogRecord.message contains an error, it will be sent using crashlytics.recordError where LogRecord.error is passed as error, LogRecord.stackTrace is passed as stackTrace, LogRecord.message is passed as reason and fatal is true if the LogRecord.level is also fatal, otherwise, is used crashlytics.log, passing the LogRecord.message as message.

To custom, pass the levels that desire to send when creating the Crashlytics Tree.

Groveman.plantTree(
    CrashlyticsTree(logLevels: [
        LogLevel.warning,
        LogLevel.info,
    ]),
  );
);

Identifier Tree #

CrashlyticsTree implements the IdentifierTree mixin, which allows you to enrich your Crashlytics reports with user and custom key data. See Customize crash reports for more details.

Set user #

Groveman.setUserIdentifier(
  UserIdentifier(
    id: '1',
    email: 'user@example.com',
    username: 'username',
    name: 'User Name',
  ),
);

The first non-null value among id, email, username, and name is passed to setUserIdentifier.

Set custom keys (tags) #

Groveman.setIdentifiers(
  tags: {
    'environment': 'production',
    'version': '1.1.0',
  },
);

Tags are set as Crashlytics custom keys via setCustomKey.

Note: Crashlytics does not support context — only tags are applied.

Clear identifiers #

Crashlytics does not support removing user identifiers or custom keys directly — clearing sets them to an empty string, as described in the documentation.

// Clears the user
Groveman.clearUserIdentifier();

// Clears specific tag keys
Groveman.clearIdentifiers(
  tagKeys: ['environment'],
);

// Clears all user and custom keys
Groveman.clearAllIdentifiers();

📝 License #

Copyright © 2026 Kauê Martins
This project is MIT licensed

2
likes
160
points
139
downloads

Documentation

Documentation
API reference

Publisher

verified publisherkmartins.dev

Weekly Downloads

Groveman tree that sends its logs to Firebase Crashlytics through recordError and logs.

Homepage
Repository (GitHub)
View/report issues

Topics

#logging #crashlytics #report

License

MIT (license)

Dependencies

firebase_crashlytics, flutter, groveman

More

Packages that depend on groveman_crashlytics