get<_Model extends OfflineFirstWithRestModel> method
Future<List<_Model> >
get<_Model extends OfflineFirstWithRestModel>({
- OfflineFirstGetPolicy policy = OfflineFirstGetPolicy.awaitRemoteWhenNoneExist,
- Query? query,
- bool seedOnly = false,
Load association from SQLite first; if the _Model
hasn't been loaded previously,
fetch it from remoteProvider and hydrate SQLite.
For available query providerArgs see remoteProvider#get
SqliteProvider.get
.
seedOnly
does not load data from SQLite after inserting records. Association queries
can be expensive for large datasets, making deserialization a significant hit when the result
is ignorable (e.g. eager loading). Defaults to false
.
Implementation
@override
Future<List<_Model>> get<_Model extends OfflineFirstWithRestModel>({
OfflineFirstGetPolicy policy = OfflineFirstGetPolicy.awaitRemoteWhenNoneExist,
query,
bool seedOnly = false,
}) async {
try {
return await super.get(
policy: policy,
query: query,
seedOnly: seedOnly,
);
} on RestException catch (e) {
logger.warning('#get rest failure: $e');
if (_ignoreTunnelException(e)) {
return <_Model>[];
}
throw OfflineFirstException(e);
}
}