Build an quiz app where there are different grade of students and every grade has different subjects just like schools. Trying to get questions according to the grade and subject provided for the questions. How to do that?
List<Question> _questions = questionsList
.map(
(question) => Question(
id: question['id'],
question: question['question'],
options: question['options'],
image: question['image'],
answer: question['answer_index']),
)
.toList();
List<Question> get questions => this._questions;
And Question.dart
class Question {
final String question;
final int answer;
final QuestionType type;
final List<String> options;
final int id;
final String description;
final String image;
final QuestionLevel questionLevel;
final int grade;
final int subject;
Question({
this.question,
this.answer,
this.type,
this.options,
this.id,
this.description,
this.image,
this.questionLevel,
this.grade,
this.subject,
});
}
question from:https://stackoverflow.com/questions/66066948/bring-list-data-according-to-subject