CancelableCompleter<T> constructor Null safety

CancelableCompleter<T>(
  1. {FutureOr onCancel(
      )?}
    )

    Creates a new completer for a CancelableOperation.

    The cancelable operation can be completed using complete or completeError.

    The onCancel function is called if the operation is canceled, by calling CancelableOperation.cancel before the operation has completed. If onCancel returns a Future, that future is also returned by CancelableOperation.cancel.

    The onCancel function will be called at most once.

    Implementation

    CancelableCompleter({FutureOr Function()? onCancel}) : _onCancel = onCancel;