cacheEntities<O> method
Caches the List entities
. This is called by the entity decoder/loader.
See cacheEntity.
Implementation
@override
void cacheEntities<O>(List<O> entities, [dynamic Function(O o)? idGetter]) {
Type? entityTYpe;
Map<dynamic, Object>? typeEntities;
Map<Object, Object Function()>? typeEntitiesInstantiators;
for (var e in entities) {
var id = getEntityID<O>(e, idGetter: idGetter);
if (id == null) continue;
if (entityTYpe != e.runtimeType) {
entityTYpe = e.runtimeType;
var entities = _entities ??= {};
typeEntities = entities[entityTYpe] ??= <Object, Object>{};
typeEntitiesInstantiators = _entitiesInstantiators?[entityTYpe];
}
typeEntities![id] = e!;
typeEntitiesInstantiators?.remove(id);
}
}