getMany method

  1. @override
Future<Map<String, AtData>> getMany(
  1. List<String> keys
)
override

Bulk fetch — returns the values for every key in keys that is currently present. Keys that are absent are NOT included in the returned map.

Implementation

@override
Future<Map<String, AtData>> getMany(List<String> keys) async {
  if (keys.isEmpty) return {};
  final normalized = keys.map(_normalize).toList();
  final placeholders = List.filled(normalized.length, '?').join(',');
  final rows = _db.raw.select(
      'SELECT atkey, value, metadata FROM at_data WHERE atkey IN ($placeholders);',
      normalized);
  final result = <String, AtData>{};
  for (final row in rows) {
    final atkey = row['atkey'] as String;
    result[atkey] = _atDataFromRow(row, atkey);
  }
  return result;
}