run method

void run(
  1. void body()
)

Setups error handler and runs body.

Implementation

void run(void Function() body) async {
  // Run body in a guarded zone to capture all uncaught errors.
  runZonedGuarded(() {
    WidgetsFlutterBinding.ensureInitialized();

    // Capture Flutter uncaught errors.
    FlutterError.onError = _onFlutterError;

    body();
  }, (Object error, StackTrace stackTrace) async {
    report(ErrorType.dart, error, stackTrace: stackTrace);
  });
}