Catcher
Catcher is a Flutter plugin that automatically catches errors and exceptions and handles them. It is heavily inspired by ACRA and offers multiple ways to handle errors across Android, iOS, Web, Linux, Windows, and macOS platforms.
Key Features
- Handling Methods: Console, Email (Manual/Auto), HTTP, File, Toast, Sentry, Slack, Discord, Snackbar, and Crashlytics.
- Report Modes: Customizable error reporting (Silent, Dialog, Page).
- Cross-Platform: Android, iOS, Web, Linux, Windows, and macOS support.
- Comprehensive Data: Automatically collects device/application info and stack traces.
Installation
Add to your pubspec.yaml:
dependencies:
catcher: ^latest_version
Basic Usage
import 'package:flutter/material.dart';
import 'package:catcher/catcher.dart';
main() {
// 1. Create configuration
CatcherOptions debugOptions = CatcherOptions(DialogReportMode(), [ConsoleHandler()]);
// 2. Initialize Catcher
Catcher(rootWidget: MyApp(), debugConfig: debugOptions);
}
class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
// 3. Add navigator key
navigatorKey: Catcher.navigatorKey,
home: Scaffold(body: Text("App Content")),
);
}
}