getCachedEntityByID<O> method

  1. @override
O? getCachedEntityByID<O>(
  1. dynamic id, {
  2. Type? type,
  3. dynamic instantiate = true,
})
override

Returns a cached entity of type with id.

Implementation

@override
O? getCachedEntityByID<O>(dynamic id, {Type? type, instantiate = true}) {
  if (id == null) return null;
  type ??= O;

  var typeEntities = _entities?[type];
  var entity = typeEntities?[id] as O?;

  if (entity == null && instantiate) {
    entity = _instantiateEntity(type, id) as O?;
  }

  return entity;
}