hydrate<_Model extends SqliteModel> method
Replenish managedObjects with new data.
Any one of the models
with a null .primaryKey
will not be inserted.
This avoids unexpected null collisions.
For convenience, the return value is the argument models
,
not the complete set of managed _Model
s.
If the managed models are desired instead, use get.
Implementation
List<_Model> hydrate<_Model extends SqliteModel>(List<_Model> models) {
if (!manages(_Model)) return models;
managedObjects[_Model] ??= {};
for (final instance in models) {
if (instance.primaryKey != null) {
managedObjects[_Model]![instance.primaryKey!] = instance;
}
}
return models;
}