get<TModel extends T> method

  1. @override
Future<List<TModel>> get<TModel extends T>({
  1. bool forceLocalSyncFromRemote = false,
  2. OfflineFirstGetPolicy policy = OfflineFirstGetPolicy.awaitRemoteWhenNoneExist,
  3. Query? query,
  4. bool seedOnly = false,
})
override

Load association from SQLite first; if the TModel 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<TModel>> get<TModel extends T>({
  /// When [forceLocalSyncFromRemote] is `true`, local instances that do not exist in the [remoteProvider]
  /// are destroyed. Further, when `true`, all values from other parameters except [query] are ignored.
  bool forceLocalSyncFromRemote = false,
  OfflineFirstGetPolicy policy = OfflineFirstGetPolicy.awaitRemoteWhenNoneExist,
  Query? query,
  bool seedOnly = false,
}) async {
  if (!forceLocalSyncFromRemote) {
    return await super.get<TModel>(
      query: query,
      policy: policy,
      seedOnly: seedOnly,
    );
  }

  return await destructiveLocalSyncFromRemote<TModel>(query: query);
}