Repository<T extends DataModelMixin<T>> class

Repository is the API used to interact with models whether local or remote.

Constructors

Repository(Ref<Object?> _ref)

Properties

hashCode int
The hash code for this object.
no setterinherited
isInitialized bool
Whether this Repository is initialized (when its underlying RemoteAdapter is).
no setter
logLevel int
getter/setter pair
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(Object model, {bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, OnSuccessOne<T>? onSuccess, OnErrorOne<T>? onError, DataRequestLabel? label}) Future<T?>
Deletes model of type T.
dispose() → void
Disposes this Repository and everything that depends on it.
findAll({bool? remote, bool? background, Map<String, dynamic>? params, Map<String, String>? headers, bool? syncLocal, OnSuccessAll<T>? onSuccess, OnErrorAll<T>? onError, DataRequestLabel? label}) Future<List<T>>
Returns all models of type T.
findOne(Object id, {bool? remote, bool? background, Map<String, dynamic>? params, Map<String, String>? headers, OnSuccessOne<T>? onSuccess, OnErrorOne<T>? onError, DataRequestLabel? label}) Future<T?>
Returns model of type T by id.
initialize({bool? remote, required Map<String, RemoteAdapter<DataModelMixin>> adapters}) FutureOr<Repository<T>>
Initializes this Repository. Nothing will work without this. In standard scenarios this initialization is done by the framework.
log(DataRequestLabel label, String message, {int logLevel = 1}) → void
Logs messages for a specific label when verbose is true.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifierFor(T model) DataStateNotifier<T?>
Notifier for watched model (local)
save(T model, {bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, OnSuccessOne<T>? onSuccess, OnErrorOne<T>? onError, DataRequestLabel? label}) Future<T>
Saves model of type T.
toString() String
A string representation of this object.
inherited
watch(T model) → T
Watch this model (local)
watchAll({bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, bool? syncLocal, String? finder, DataRequestLabel? label}) DataState<List<T>>
Watches a provider wrapping Repository.watchAllNotifier which allows the watcher to be notified of changes on any model of this type.
watchAllNotifier({bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, bool? syncLocal, String? finder, DataRequestLabel? label}) DataStateNotifier<List<T>>
watchAllProvider({bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, bool? syncLocal, String? finder, DataRequestLabel? label}) AutoDisposeStateNotifierProvider<DataStateNotifier<List<T>>, DataState<List<T>>>
watchOne(Object model, {bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, AlsoWatch<T>? alsoWatch, String? finder, DataRequestLabel? label}) DataState<T?>
Watches a provider wrapping Repository.watchOneNotifier which allows the watcher to be notified of changes on a specific model of this type, optionally reacting to selected relationships of this model via alsoWatch.
watchOneNotifier(Object model, {bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, AlsoWatch<T>? alsoWatch, String? finder, DataRequestLabel? label}) DataStateNotifier<T?>
watchOneProvider(Object model, {bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, AlsoWatch<T>? alsoWatch, String? finder, DataRequestLabel? label}) AutoDisposeStateNotifierProvider<DataStateNotifier<T?>, DataState<T?>>

Operators

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