manager<T extends DatumEntityInterface> static method
Provides access to the specific manager for an entity type.
Implementation
static DatumManager<T> manager<T extends DatumEntityInterface>() {
// Prevent using DatumEntityInterface directly as it is the base interface
if (T == DatumEntityInterface) {
throw ArgumentError(
'Cannot use DatumEntityInterface directly. You must use a concrete entity type that implements DatumEntityInterface. '
'For example: Datum.manager<MyEntity>() instead of Datum.manager<DatumEntityInterface>().',
);
}
final manager = instance._managers[T];
if (manager == null) {
throw StateError('Entity type $T is not registered.');
}
return manager as DatumManager<T>;
}