CancelableCompleter<T> constructor

  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.


    CancelableCompleter({FutureOr Function() onCancel})
        : _onCancel = onCancel,
          _inner = Completer<T>() {
      _operation = CancelableOperation<T>._(this);