flagging
This commit is contained in:
@@ -25,6 +25,20 @@ class DeckService {
|
||||
return deck.copyWith(questions: updatedQuestions);
|
||||
}
|
||||
|
||||
/// Toggles the flagged state of a question.
|
||||
static Deck toggleQuestionFlag({
|
||||
required Deck deck,
|
||||
required String questionId,
|
||||
}) {
|
||||
final updatedQuestions = deck.questions.map((q) {
|
||||
if (q.id == questionId) {
|
||||
return q.copyWith(isFlagged: !q.isFlagged);
|
||||
}
|
||||
return q;
|
||||
}).toList();
|
||||
return deck.copyWith(questions: updatedQuestions);
|
||||
}
|
||||
|
||||
/// Marks a question as needs practice (manual override).
|
||||
///
|
||||
/// Sets isKnown to false and streak to 0, but keeps priority unchanged.
|
||||
|
||||
Reference in New Issue
Block a user