MemoryCacheProvider class

Query models by SQLite primary key, sparing a more expensive on-disk lookup.

MemoryCacheProvider does not have a type argument due to a build_runner exception:


MemoryCacheProvider([List<Type> managedModelTypes = const <Type>[]])
It is strongly recommended to use this provider with smaller, frequently-accessed and shared SqliteModels.


hashCode int
The hash code for this object.
no setterinherited
logger → Logger
managedModelTypes List<Type>
The only model classes this instance should track. As storing objects in memory can be costly elsewhere in the app, models should be judiciously added to this property.
managedObjects Map<Type, Map<int, SqliteModel>>
A complete hash table of the
getter/setter pair
modelDictionary → ModelDictionary<Model, Adapter<Model>>
Only present to conform to the Provider spec.
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


canFind<TModel extends SqliteModel>([Query? query]) bool
Whether the results of this provider are worth evaluating.
delete<TModel extends SqliteModel>(TModel instance, {Query? query, ModelRepository<SqliteModel>? repository}) bool
Remove a model instance
exists<T extends TModel>({Query? query, ModelRepository<SqliteModel>? repository}) → dynamic
Whether a model instance is present. null is returned when existence is unknown. The model instance is not hydrated in the function output; a bool variant (e.g. List<bool>, Map<TModel, bool>) should be returned.
get<TModel extends SqliteModel>({Query? query, ModelRepository<SqliteModel>? repository}) List<TModel>?
Query for raw data and construct it with an Adapter
hydrate<TModel extends SqliteModel>(List<TModel> models) List<TModel>
Replenish managedObjects with new data. Any one of the models with a null .primaryKey will not be inserted. This avoids unexpected null collisions.
manages(Type type) bool
Is the type cached by this provider?
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
reset() → void
Destructively wipes all tracked instances. Irreversible.
toString() String
A string representation of this object.
upsert<TModel extends SqliteModel>(TModel instance, {Query? query, ModelRepository<SqliteModel>? repository}) → TModel?
Insert or update a model instance


operator ==(Object other) bool
The equality operator.