flutter_forge_ops_tracker 0.1.0
flutter_forge_ops_tracker: ^0.1.0 copied to clipboard
Flutter-specific automatic error capture on top of package:forge_ops_tracker -- FlutterError.onError and PlatformDispatcher.instance.onError. A separate package, not folded into forge_ops_tracker itse [...]
flutter_forge_ops_tracker #
Flutter-specific automatic error capture on top of
forge_ops_tracker, the core Dart client for a
private, self-hosted ForgeOps tracker instance. A separate package
rather than folded into that one, specifically so a plain Dart (non-Flutter) consumer never has
to pull in the Flutter SDK.
Installation #
# pubspec.yaml
dependencies:
forge_ops_tracker: ^0.1.0
flutter_forge_ops_tracker: ^0.1.0
Or: flutter pub add forge_ops_tracker flutter_forge_ops_tracker
Usage #
Call installFlutterErrorHandlers() once, after configuring the core client, before runApp:
import 'package:forge_ops_tracker/forge_ops_tracker.dart' as forge_ops_tracker;
import 'package:flutter_forge_ops_tracker/flutter_forge_ops_tracker.dart';
void main() {
forge_ops_tracker.init((config) {
config.dsn = 'https://<api_key>@your-forgeops-host/api/v1/events';
});
installFlutterErrorHandlers();
runApp(MyApp());
}
This wires two Flutter-specific error paths the core client's own runGuarded helper doesn't
see on its own:
FlutterError.onError: an error the framework itself catches while building, laying out, or painting a widget, what would otherwise render Flutter's own red "error" screen in debug mode. Chains to whatever handler was already installed rather than replacing it, so that error screen still renders exactly as it would without this package.PlatformDispatcher.onError: anything that escapes the rootZoneinstead, an error in an async callback, aFuturewhose error was never caught. Reports, then preserves whatever the engine's own default behavior would otherwise be, the same "report, don't change program behavior" rule the core client'srunGuardedfollows for non-Flutter code.
See the core forge_ops_tracker README for
configuration options, PII scrubbing, and delivery behavior, all shared with this package since
it's the same client underneath.
Running the tests #
cd sdks/dart/flutter_forge_ops_tracker
flutter pub get
flutter test
flutter analyze