performCancellableAsyncOperation<T> method

  1. @protected
Future<T?> performCancellableAsyncOperation<T>(
  1. Future<T> opreation
)
inherited

Performs an asynchronous operation and cancels it if the BloC is closed.

Implementation

@protected
Future<T?> performCancellableAsyncOperation<T>(Future<T> opreation) {
  if (shouldProcessEventInOrder()) {
    return opreation;
  }

  final cancellableOperation = CancelableOperation<T>.fromFuture(opreation);
  cancelableOperations.add(cancellableOperation);

  return cancellableOperation.valueOrCancellation();
}