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.
read-onlyinherited
- isInitialized → bool
-
Whether this Repository is initialized
(when its underlying RemoteAdapter is).
read-only
- logLevel ↔ int
-
read / write
-
offlineOperations
→ Set<
OfflineOperation< T>> -
Gets a list of all pending
OfflineOperation
s for this type.read-only -
remoteAdapter
→ RemoteAdapter<
T> -
Obtain the RemoteAdapter for this type.
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- type → String
-
Type for the RemoteAdapter
read-only
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 typeT
. -
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
byid
. -
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
istrue
. -
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 typeT
. -
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