toAsync method

Async<T> toAsync({
  1. @noFutures TOnErrorCallback<T>? onError,
  2. @noFutures TVoidCallback? onFinalize,
})

Implementation

@pragma('vm:prefer-inline')
Async<T> toAsync({
  @noFutures TOnErrorCallback<T>? onError,
  @noFutures TVoidCallback? onFinalize,
}) {
  assert(
    !isSubtype<T, Future<Object>>(),
    'Do not call toAsync on nested futures: $T.',
  );
  return Async(() => this, onError: onError, onFinalize: onFinalize);
}