explanation
This commit is contained in:
@@ -6,6 +6,9 @@ class Question {
|
||||
/// The question prompt.
|
||||
final String prompt;
|
||||
|
||||
/// Optional explanation shown when viewing question details (e.g. after an attempt).
|
||||
final String? explanation;
|
||||
|
||||
/// List of possible answers.
|
||||
final List<String> answers;
|
||||
|
||||
@@ -42,6 +45,7 @@ class Question {
|
||||
Question({
|
||||
required this.id,
|
||||
required this.prompt,
|
||||
this.explanation,
|
||||
required this.answers,
|
||||
List<int>? correctAnswerIndices,
|
||||
@Deprecated('Use correctAnswerIndices instead') int? correctAnswerIndex,
|
||||
@@ -60,6 +64,7 @@ class Question {
|
||||
Question copyWith({
|
||||
String? id,
|
||||
String? prompt,
|
||||
String? explanation,
|
||||
List<String>? answers,
|
||||
List<int>? correctAnswerIndices,
|
||||
@Deprecated('Use correctAnswerIndices instead') int? correctAnswerIndex,
|
||||
@@ -74,6 +79,7 @@ class Question {
|
||||
return Question(
|
||||
id: id ?? this.id,
|
||||
prompt: prompt ?? this.prompt,
|
||||
explanation: explanation ?? this.explanation,
|
||||
answers: answers ?? this.answers,
|
||||
correctAnswerIndices: correctAnswerIndices ?? this.correctAnswerIndices,
|
||||
correctAnswerIndex: correctAnswerIndex ?? this.correctAnswerIndex,
|
||||
@@ -119,6 +125,7 @@ class Question {
|
||||
runtimeType == other.runtimeType &&
|
||||
id == other.id &&
|
||||
prompt == other.prompt &&
|
||||
explanation == other.explanation &&
|
||||
answers.toString() == other.answers.toString() &&
|
||||
correctAnswerIndices.toString() == other.correctAnswerIndices.toString() &&
|
||||
consecutiveCorrect == other.consecutiveCorrect &&
|
||||
@@ -133,6 +140,7 @@ class Question {
|
||||
int get hashCode =>
|
||||
id.hashCode ^
|
||||
prompt.hashCode ^
|
||||
(explanation?.hashCode ?? 0) ^
|
||||
answers.hashCode ^
|
||||
correctAnswerIndices.hashCode ^
|
||||
consecutiveCorrect.hashCode ^
|
||||
|
||||
Reference in New Issue
Block a user