SyncRepository class Null safety
- Inheritance
Constructors
- SyncRepository({required SyncConfig config, BearerHttpClient? client})
Properties
- autoHydrate → bool
-
Refetch results in the background from remote source when any request is made.
Defaults to
false
.final, inherited - hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- logger → Logger
-
User for low-level debugging. The logger name can be defined in the default constructor;
it defaults to
OfflineFirstRepository
.@protected, final, inherited - memoryCacheProvider → MemoryCacheProvider
-
The first data source to speed up otherwise taxing queries. Only caches specified models.
final, inherited
- migrationManager → MigrationManager
-
final, inherited
- offlineRequestQueue ↔ OfflineRequestQueue
-
@protected, read / write, inherited
-
reattemptForStatusCodes
→ List<
int> -
If the response returned from the client is one of these error codes, the request
will not be removed from the queue. For example, if the result of a request produces a
404 status code response (such as in a Tunnel not found exception), the request will
be reattempted. If upsert response matches this status code, it will not throw
an exception. [...]
@protected, final, inherited
- remoteProvider → RestProvider
-
The type declaration is important here for the rare circumstances that
require interfacting with RestProvider's client directly.
final, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- sqliteProvider → SqliteProvider
-
The local data source utilized before every operation.
final, inherited
- throwTunnelNotFoundExceptions → bool
-
When the device is connected but the URL is unreachable, the response will
begin with "Tunnel" and ends with "not found". [...]
final, inherited
Methods
-
delete<
_Model extends OfflineFirstWithRestModel> (_Model instance, {Query? query}) → Future< bool> -
Remove a model from SQLite and the remoteProvider
inherited
-
exists<
_Model extends _RepositoryModel> ({Query? query}) → Future< bool> -
Check if a
_Model
is accessible locally. First checks if there's a matching query in memoryCacheProvider and then check sqliteProvider. Does not query remoteProvider.inherited -
get<
_Model extends OfflineFirstWithRestModel> ({Query? query, bool alwaysHydrate = false, bool hydrateUnexisting = true, bool requireRemote = false, bool seedOnly = false}) → Future< List< _Model> > -
Load association from SQLite first; if the
_Model
hasn't been loaded previously, fetch it from remoteProvider and hydrate SQLite. For available query providerArgs seeremoteProvider#get
SqliteProvider.get. [...]inherited -
getAssociation<
_Model extends _RepositoryModel> (Query query) → Future< List< _Model> ?> -
Used exclusively by the
OfflineFirstAdapter
. If there are no results, returnsnull
.inherited -
getBatched<
_Model extends _RepositoryModel> ({Query? query, int batchSize = 50, bool requireRemote = false, bool seedOnly = false}) → Future< List< _Model> > -
Get all results in series of
batchSize
s (defaults to50
). Useful for large queries or remote results. [...]inherited -
hydrate<
_Model extends OfflineFirstWithRestModel> ({bool deserializeSqlite = true, Query? query}) → Future< List< _Model> > -
Fetch and store results from remoteProvider into SQLite and the memory cache. [...]
@protected, inherited
-
initialize(
) → Future< void> -
Prepare the environment for future repository functions. It is recommended to call this
method within a
StatefulWidget
'sinitState
to ensure it is only invoked once. It is not automatically invoked. [...]@mustCallSuper, inherited -
migrate(
) → Future< void> -
Update SQLite structure with only new migrations.
@mustCallSuper, inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
reset(
) → Future< void> -
Destroys all local records - specifically, memoryCache and sqliteProvider's
data sources.
inherited
-
storeRemoteResults<
_Model extends _RepositoryModel> (List< _Model> models) → Future<List< _Model> > -
Save response results to SQLite.
@protected, @visibleForTesting, inherited
-
toString(
) → String -
A string representation of this object. [...]
inherited
-
upsert<
_Model extends OfflineFirstWithRestModel> (_Model instance, {Query? query, bool throwOnReattemptStatusCodes = false}) → Future< _Model> -
throwOnReattemptStatusCodes
- whentrue
, the repository will throw an OfflineFirstException for responses that include a code withinreattemptForStatusCodes
. Defaultsfalse
.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited