getTopicById method

Future<TopicModel?> getTopicById(
  1. String topicId
)

Fetch a single topic by ID.

Implementation

Future<TopicModel?> getTopicById(String topicId) async {
  final response = await _client
      .from('topics')
      .select()
      .eq('id', topicId)
      .maybeSingle();
  if (response == null) return null;
  return TopicModel.fromJson(response);
}