GenericModelMap<T extends BaseModel> constructor

GenericModelMap<T extends BaseModel>({
  1. required DatabaseRepository repository(),
  2. required ModelConstructor<T> supplier,
  3. String? defaultDatabaseName,
})

Maintains a map for the T models with their id as their key.

supplier generates a new instance of T

repository gives this the instance of the DatabaseRepository to be used in the automatic loading functions of this class.

defaultDatabaseName is the database the repository will use. This can be overridden in all the loading functions of this class.

Implementation

GenericModelMap({
  required this.repository,
  required this.supplier,
  this.defaultDatabaseName,
});