replaceQuery method
Future<CollectionBase<TModel> >
replaceQuery(
- CollectionModelQuery callback(
- CollectionModelQuery source
callback
will redefine a new CollectionModelQuery and execute reload.
Use this function when you want to read the file again with new conditions.
callback
により新しくCollectionModelQueryを定義し直してreloadを実行します。
新しい条件で再度読み込みをおこないたい場合に利用します。
Implementation
Future<CollectionBase<TModel>> replaceQuery(
CollectionModelQuery Function(CollectionModelQuery source) callback,
) async {
final prevQuery = modelQuery;
_modelQuery = callback.call(modelQuery);
if (modelQuery != prevQuery) {
_databaseQuery = null;
_databaseQuery = databaseQuery.copyWith(
query: modelQuery,
);
_modelQuery.adapter.disposeCollection(databaseQuery);
await reload();
} else {
_modelQuery = prevQuery;
}
return this;
}