findExistingIds method

Future<Set<int>> findExistingIds(
  1. List<int> ids
)

Implementation

Future<Set<int>> findExistingIds(List<int> ids) async {
  if (_db == null || !_isOpen || ids.isEmpty) return <int>{};
  try {
    final placeholders = ids.map((_) => '?').join(',');
    final result = await _db!.rawQuery(
      'SELECT id FROM $_tableName WHERE id IN ($placeholders)',
      ids,
    );
    return result
        .map((row) => row['id'])
        .whereType<int>()
        .toSet();
  } catch (e, st) {
    dbLogger.severe('SqliteEventStorage: findExistingIds failed', e, st);
    await _handlePotentialCorruption(e);
    return ids.toSet();
  }
}