flutter_crash_guard 2.0.0 copy "flutter_crash_guard: ^2.0.0" to clipboard
flutter_crash_guard: ^2.0.0 copied to clipboard

State-management agnostic error handling mixin and Firebase Crashlytics integration with severity and categorization.

example/flutter_crash_guard_example.dart

import 'package:flutter_crash_guard/flutter_crash_guard.dart';

/// Minimal example: a class using [ErrorHandlingMixin] with the getter-based API.
///
/// Implement [errorHandlingService] with your DI (Riverpod: ref.read(errorHandlingServiceProvider),
/// GetIt: GetIt.I<ErrorHandlingService>(), etc.). Then call [handleError] without a ref.
class ExampleService with ErrorHandlingMixin {
  ExampleService(this._errorHandlingService);

  final ErrorHandlingService _errorHandlingService;

  @override
  ErrorHandlingService get errorHandlingService => _errorHandlingService;

  Future<void> load() async {
    try {
      // Simulate work that might throw.
      throw StateError('Example failure');
    } catch (e, s) {
      handleError(operation: 'load', error: e, stackTrace: s);
    }
  }
}

void main() {
  // Full setup requires Firebase init and DI registration (see README).
  // This demonstrates the API: implement errorHandlingService getter, call handleError(...).
  final service = ErrorHandlingService();
  final example = ExampleService(service);
  example.load();
}
8
likes
150
points
112
downloads

Publisher

unverified uploader

Weekly Downloads

State-management agnostic error handling mixin and Firebase Crashlytics integration with severity and categorization.

Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

BSD-3-Clause (license)

Dependencies

dio, firebase_core, firebase_crashlytics, flutter, hooks_riverpod, package_info_plus

More

Packages that depend on flutter_crash_guard