removeFromCache static method

void removeFromCache({
  1. Type? type,
  2. Bloc? bloc,
})

Removes blocs from the container cache

If a type is provided then all blocs of that type are removed. If a bloc is provided then that specific bloc is removed

Implementation

static void removeFromCache({Type? type, Bloc? bloc}) {
  assert(type != null || bloc != null);

  if (type != null) {
    _cache.removeWhere((key, value) => key.type == type);
  } else if (bloc != null) {
    _cache.removeWhere((key, value) => value == bloc);
  }
}