CancelableCompleter<T> constructor Null safety

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

    Creates a new completer for a CancelableOperation.

    When the future operation canceled, as long as the completer hasn't yet completed, onCancel is called. If onCancel returns a Future, it's forwarded to CancelableOperation.cancel.

    onCancel will be called synchronously when the operation is canceled. It's guaranteed to only be called once.

    Implementation

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