getTopicsByIds method

Future<List<TopicModel>> getTopicsByIds(
  1. Set<String> ids
)

Batch-fetch topics by ID in a single round-trip. Mirrors getDomainsByIds. Returns an empty list when ids is empty so callers don't need a guard.

Implementation

Future<List<TopicModel>> getTopicsByIds(Set<String> ids) async {
  if (ids.isEmpty) return const [];
  final response = await _client
      .from('topics')
      .select()
      .inFilter('id', ids.toList());
  return (response as List<dynamic>)
      .map((row) => TopicModel.fromJson(row as Map<String, dynamic>))
      .toList();
}