updateWhere method
Update items that match spec within the scope.
For stores that support soft delete, implementations SHOULD avoid updating tombstoned rows.
Returns the number of affected rows if available, else -1.
Implementation
@override
Future<int> updateWhere(
SyncScope scope,
store.QuerySpec spec,
List<T> newValues,
) async {
if (newValues.isEmpty) return 0;
// Find matching ids, then upsert only those provided in newValues whose id is in the match set.
final matched = await queryWith(scope, spec);
if (matched.isEmpty) return 0;
final matchIds = matched.map(idOf).toSet();
final toApply = newValues.where((e) => matchIds.contains(idOf(e))).toList();
if (toApply.isEmpty) return 0;
await upsertMany(scope, toApply);
return toApply.length;
}