ModelRepository<_ManagedModel extends Model> class Null safety

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.





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


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 non-existent method or property is accessed. [...]
toString() String
A string representation of this object. [...]
upsert<_Model extends _ManagedModel>(_Model model, {Query query}) → dynamic
Insert or update a model in all Providers [...]


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