DatabaseRepository class abstract
Represents a class that implements some specific implementation of an interface with storage. Classes that implement this must retain data that is saved using the various functions such as saveModel and be retrieved using findModel in a separate session.
- Implementers
Constructors
Properties
- channel ↔ BlocEventChannel
-
This is shared between all
Repository
s in the repository layer.latefinalinherited -
errorStream
→ StreamController<
DatabaseException> -
Listen for
DatabaseException
s that occur from trying to access this database.latefinal - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
containsRows<
T extends BaseModel> (String database, T supplier()) → FutureOr< bool> -
Returns true if the table/container in
database
contains any data with same type provided bysupplier
-
deleteModel<
T extends BaseModel> (String database, T model) → FutureOr< bool> -
Deletes the
T
model
indatabase
.model
doesn not need to be exactly the same, just have the same id. -
dispose(
) → void - Disposes this value to save memory. Implementations should be idempotent.
-
findAllModelsOfType<
T extends BaseModel> (String database, T supplier()) → FutureOr< Iterable< T> > -
This functions finds all models of the given type that have their
BaseModel.id start with the prefix given by the
supplier
s BaseModelIDExtension.prefixTypeForId -
findModel<
T extends BaseModel> (String database, String key) → FutureOr< T?> -
Finds the
T
model indatabase
with id ofkey
. -
findModels<
T extends BaseModel> (String database, Iterable< String> keys) → FutureOr<Iterable< T> > -
Finds all the models in the given
database
that have the givenkeys
-
generateListeners(
BlocEventChannel channel) → List< BlocEventListener> -
Generates the listener map that this
Repository
will remove from thechannel
when this repository is disposed.inherited -
initialize(
BlocEventChannel channel) → void -
Initializes this repository, adding the listeners produced by
generateListeners to the given
channel
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
saveModel<
T extends BaseModel> (String database, T model) → FutureOr< T> -
Saves the
T
model
indatabase
.model
s that do not have an existing id will have one automatically assigned to them. This function doesn't care if there is an already existing model or not. Existing models will just be overridden -
saveModels<
T extends BaseModel> (String database, Iterable< T> models) → FutureOr<void> -
Saves the
T
models
indatabase
.models
that do not have an existing id will have one automatically assigned to them. This function doesn't care if there is an already existing model or not. Existing models will just be overridden -
searchByModelAndFields<
T extends BaseModel> (String database, T supplier(), T model, List< String> fields) → FutureOr<Iterable< T> > -
Finds all models in
database
that have values that match the passedmodel
's values -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited