runGuarded method

void runGuarded(
  1. void action()
)

Executes the given action in this zone and catches synchronous errors.

This function is equivalent to:

try {
  this.run(action);
} catch (e, s) {
  this.handleUncaughtError(e, s);
}

See run.

Implementation

void runGuarded(void Function() action) {
  try {
    return _runZoned<void>(this, action);
  } catch (e, s) {
    _handleUncaughtErrorZoned(this, e, s);
  }
}