unZonedGuarded instead&quot;) Function onError}) {
  ArgumentError.checkNotNull(body, &quot;body&quot;);

  if (onError != null) {
    void Function(Object, StackTrace) typedOnError;
    if (onError is void Function(Object, StackTrace)) {
      typedOnError = onError;
    } else if (onError is void Function(Object)) {
      typedOnError = (Object e, StackTrace _) =&gt; onError(e);
    } else {
      throw ArgumentError.value(onError, &quot;onError&quot;,
          &quot;Should accept one error, or one error