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<_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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
upsert<_Model extends _ManagedModel>(_Model model, {Query query}) → dynamic
Insert or update a model in all Providers

Operators

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