runZoneGuarded static method

void runZoneGuarded(
  1. VoidCallback callback
)

Runs callback in its own error zone created by runZonedGuarded, and reports all exceptions to AppMetrica.

Implementation

static void runZoneGuarded(VoidCallback callback) {
  runZonedGuarded(() {
    WidgetsFlutterBinding.ensureInitialized();
    callback();
  }, (Object err, StackTrace stack) {
    _logger.warning("error caught by Zone", err, stack);
    if (ActivationConfigHolder.lastActivationConfig != null) {
      _appMetrica.reportUnhandledException(convertErrorDetails(
          err.runtimeType.toString(),
          err.toString(),
          stack
      )).ignore();
    }
  });
}