isCachedEntityByID<O> method

  1. @override
bool isCachedEntityByID<O>(
  1. dynamic id, {
  2. Type? type,
})
override

Returns a cached entity of type with id.

Implementation

@override
bool isCachedEntityByID<O>(dynamic id, {Type? type}) {
  if (id == null) return false;
  type ??= O;

  var typeEntities = _entities?[type];
  if (typeEntities != null && typeEntities.containsKey(id)) {
    return true;
  }

  var typeEntitiesInstantiators = _entitiesInstantiators?[type];
  if (typeEntitiesInstantiators != null &&
      typeEntitiesInstantiators.containsKey(id)) {
    return true;
  }

  return false;
}