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
OfflineOperation
s 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 typeT
. -
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< ? onError}) → Future<T> >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
byid
. -
initialize(
{bool? remote, bool? verbose, required Map< String, RemoteAdapter< adapters}) → FutureOr<DataModel> >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 typeT
. -
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
byid
in local storage.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited