getGoals method

Future<List<LearningGoalModel>> getGoals()

Implementation

Future<List<LearningGoalModel>> getGoals() async {
  final userId = _client.auth.currentUser?.id;
  if (userId == null) return [];

  final response = await _client
      .from('learning_goals')
      .select()
      .eq('user_id', userId)
      .order('status', ascending: true);
  return (response as List<dynamic>)
      .map((row) => LearningGoalModel.fromJson(row as Map<String, dynamic>))
      .toList();
}