Repository<T extends DataModel<T>> class

Thin wrapper on the RemoteAdapter API

Constructors

Repository(ProviderReference _ref)

Properties

hashCode int
The hash code for this object.
no setterinherited
isInitialized bool
Returns whether this Repository is initialized (when its underlying RemoteAdapter is).
no setter
offlineOperations Set<OfflineOperation<T>>
Gets a list of all pending OfflineOperations for this type.
no setter
remoteAdapter RemoteAdapter<T>
Obtain the RemoteAdapter for this type.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type String
Type for the RemoteAdapter
no setter

Methods

clear() Future<void>
Deletes all models of type T in local storage.
delete(dynamic model, {bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, OnData<void>? onSuccess, OnDataError<void>? onError}) Future<void>
Deletes model of type T.
dispose() → void
Disposes this Repository and everything that depends on it.
findAll({bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, bool? syncLocal, OnDataError<List<T>>? onError}) Future<List<T>>
Returns all models of type T.
findOne(dynamic id, {bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, OnDataError<T>? onError}) Future<T?>
Returns model of type T by id.
initialize({bool? remote, bool? verbose, required Map<String, RemoteAdapter<DataModel>> adapters}) FutureOr<Repository<T>>
Initializes this Repository. Nothing will work without this. In standard scenarios this initialization is done by the framework.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
save(T model, {bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, OnData<T>? onSuccess, OnDataError<T>? onError}) Future<T>
Saves model of type T.
toString() String
A string representation of this object.
inherited
watchAll({bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, bool? syncLocal, bool filterLocal(T)?}) DataStateNotifier<List<T>>
Watches changes on all models of type T in local storage.
watchOne(dynamic id, {bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, AlsoWatch<T>? alsoWatch}) DataStateNotifier<T?>
Watches changes on model of type T by id in local storage.

Operators

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