cancelPreload method

bool cancelPreload(
  1. String key
)

Cancels a preloading operation.

Returns true if the operation was cancelled, false if it was not found or already completed.

Implementation

bool cancelPreload(String key) {
  final operation = _operations[key];
  if (operation == null) {
    return false;
  }

  if (operation.status == PreloadStatus.notStarted ||
      operation.status == PreloadStatus.inProgress) {
    operation.markCancelled();
    _preloadController.add(operation);
    return true;
  }

  return false;
}