Skip to content

Running app in error zone #54

@markst

Description

@markst

Struggling to find much documentation on correct way of catching Flutter app errors.

Here's what I have:

void main() async {
  runZonedGuarded<Future<void>>(() async {
    FlutterError.onError =
        (details) => AppCenter.trackErrorAsync(details.exceptionAsString());

    WidgetsFlutterBinding.ensureInitialized();

    await AppCenter.startAsync(
      appSecretAndroid: 'xx',
      appSecretIOS: 'xxx',
      enableCrashes: true, // Defaults to true
    );

    runApp(App());
  },
      (error, stackTrace) =>
          Zone.current.handleUncaughtError(error, stackTrace));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions