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 queries = buildRemoteSearchQueries(scope, spec);
  // Test hook: execute via injected runner when provided
  if (config.searchRunner != null) {
    final rows = await config.searchRunner!(queries);
    return rows
        .map((e) => config.fromJson(Map<String, dynamic>.from(e)))
        .toList(growable: false);
  }
  final res = await config.tablesDB.listRows(
    databaseId: config.databaseId,
    tableId: config.tableId,
    queries: queries,
  );
  return res.rows
      .map((r) => config.fromJson(Map<String, dynamic>.from(r.data)))
      .toList(growable: false);
}