bugsnag_crashlytics 1.0.0 bugsnag_crashlytics: ^1.0.0 copied to clipboard
Flutter plugin for Bugsnag Crashlytics. It reports uncaught errors to the Bugsnag console.
import 'dart:async';
import 'package:bugsnag_crashlytics/bugsnag_crashlytics.dart';
import 'package:flutter/material.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
BugsnagCrashlytics.instance.register(
androidApiKey: "ANDROID_API_KEY",
iosApiKey: "IOS_API_KEY",
releaseStage: 'RELEASE_STAGE',
appVersion: 'APP_VERSION');
FlutterError.onError = BugsnagCrashlytics.instance.recordFlutterError;
runZonedGuarded<Future<void>>(() async {
runApp(
MyApp());
}, BugsnagCrashlytics.instance.recordError);
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Text("Hello Bugsnag"),
),
),
);
}
}