remoteSearch method

  1. @override
Future<List<T>> remoteSearch(
  1. SyncScope scope,
  2. QuerySpec spec
)
override

Search within a scope using a normalized query spec. Implementations should apply soft-delete semantics and only support operators and fields that are natively available on the backend. Unsupported operators/fields must throw ArgumentError with a clear message.

Implementation

@override
Future<List<T>> remoteSearch(SyncScope scope, QuerySpec spec) async {
  final req = buildRemoteSearchRequest(scope, spec);
  final list = await config.client
      .collection(config.collection)
      .getList(page: req.$3, perPage: req.$4, filter: req.$1, sort: req.$2);
  final results = <T>[];
  for (final rec in list.items) {
    final data = Map<String, dynamic>.from(rec.data);
    results.add(config.fromJson(data));
  }
  return results;
}