MemoryCacheProvider<CModel extends SqliteModel> 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: https://github.com/dart-lang/sdk/issues/38309

Constructors

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

Properties

hashCode int
The hash code for this object.
no setterinherited
logger → Logger
final
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.
final
managedObjects Map<Type, Map<int, CModel>>
A complete hash table of the
getter/setter pair
modelDictionary → ModelDictionary<Model, Adapter<Model>>
Only present to conform to the Provider spec.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

canFind<TModel extends CModel>([Query? query]) bool
Whether the results of this provider are worth evaluating.
delete<TModel extends CModel>(TModel instance, {Query? query, ModelRepository<CModel>? repository}) bool
Remove a model instance
exists<T extends TModel>({Query? query, ModelRepository<CModel>? 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.
inherited
get<TModel extends CModel>({Query? query, ModelRepository<CModel>? repository}) List<TModel>?
Query for raw data and construct it with an Adapter
hydrate<TModel extends CModel>(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.
inherited
reset() → void
Destructively wipes all tracked instances. Irreversible.
toString() String
A string representation of this object.
inherited
upsert<TModel extends CModel>(TModel instance, {Query? query, ModelRepository<CModel>? repository}) → TModel?
Insert or update a model instance

Operators

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