clearCompletedOperations method

int clearCompletedOperations()

Clears completed operations from the operations map.

Returns the number of operations that were cleared.

Implementation

int clearCompletedOperations() {
  final keysToRemove = <String>[];

  for (final entry in _operations.entries) {
    if (entry.value.status == PreloadStatus.completed ||
        entry.value.status == PreloadStatus.failed ||
        entry.value.status == PreloadStatus.cancelled) {
      keysToRemove.add(entry.key);
    }
  }

  for (final key in keysToRemove) {
    _operations.remove(key);
  }

  return keysToRemove.length;
}