ModelRepository<ManagedModel extends Model> class abstract

A Repository is the top-level means of relaying data between Models and Providers. A conventional implementation would adhere to the singleton pattern.

It should handle the app's caching strategy between Providers. For example, if an app has an offline-first caching strategy, the Repository first fetches from a SqliteProvider and then a RestProvider before returning one result. An app should have one Repository for one data flow (similar to having one Redux store as the source of truth).

implementing this class is not necessary. It's supplied as a standardized, opinionated way to structure your Store.

Implementers

Constructors

ModelRepository()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

delete<TModel extends ManagedModel>(TModel instance, {Query query}) → dynamic
Delete a model from all Providers.
get<TModel extends ManagedModel>({Query query}) → dynamic
Query for raw data from all Providers.
initialize() Future<void>
Perform required setup work. For example, migrating a database, starting a queue, or authenticating with a Provider's service.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
upsert<TModel extends ManagedModel>(TModel model, {Query query}) → dynamic
Insert or update a model in all Providers

Operators

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