deleteWhere method

  1. @override
Future<int> deleteWhere(
  1. SyncScope scope,
  2. QuerySpec spec
)
override

Delete items that match spec within the scope. Applies soft/hard delete semantics in the same way as deleteMany. Returns the number of affected rows if available, else -1.

Implementation

@override
Future<int> deleteWhere(SyncScope scope, store.QuerySpec spec) async {
  final matched = await queryWith(scope, spec);
  if (matched.isEmpty) return 0;
  final ids = matched.map(idOf).toList(growable: false);
  await deleteMany(scope, ids);
  return ids.length;
}