ModelRepository<_ManagedModel extends Model> class

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. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

delete<_Model extends _ManagedModel>(_Model instance, {Query query}) → dynamic
Delete a model from all Providers. [...]
get<_Model 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.
upsert<_Model extends _ManagedModel>(_Model model, {Query query}) → dynamic
Insert or update a model in all Providers [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited