diff --git a/app/lib/features/quiz_exercise/presentation/bloc/quiz_exercise_event.dart b/app/lib/features/quiz_exercise/presentation/bloc/quiz_exercise_event.dart index 1534308..cad15e3 100644 --- a/app/lib/features/quiz_exercise/presentation/bloc/quiz_exercise_event.dart +++ b/app/lib/features/quiz_exercise/presentation/bloc/quiz_exercise_event.dart @@ -8,5 +8,5 @@ abstract class QuizExerciseEvent extends Equatable { } class GetQuizExercise extends QuizExerciseEvent { - GetQuizExercise(); + const GetQuizExercise(); } diff --git a/app/lib/features/quiz_exercise/presentation/repositories/quiz_exercise.dart b/app/lib/features/quiz_exercise/presentation/repositories/quiz_exercise.dart index ea1352d..5262560 100644 --- a/app/lib/features/quiz_exercise/presentation/repositories/quiz_exercise.dart +++ b/app/lib/features/quiz_exercise/presentation/repositories/quiz_exercise.dart @@ -5,17 +5,15 @@ import '../model/quiz_exercise.dart'; @injectable class QuizExerciseRepository { - final _firecloud = FirebaseFirestore.instance.collection('task_set'); - Future> getAll() async { - List quizExerciseList = []; + final quizExerciseList = []; try { final result = await FirebaseFirestore.instance.collection('task_set').get(); + for (final element in result.docs) { + quizExerciseList.add(QuizExercise.fromJson(element.data())); + } - result.docs.forEach((element) { - return quizExerciseList.add(QuizExercise.fromJson(element.data())); - }); return quizExerciseList; } on FirebaseException catch (e) { if (kDebugMode) {