CheckQuestion class final

A question a lesson step or an experiment step asks: the text, the answers accepted, and how many attempts a student has before an accepted answer is shown.

One shape for both documents. An edu_step entity carries it under check, and a step of an f3d.experiment scenario carries it under the same key, so the viewer that asks it and the wire that reports the answer to a learning platform read one type.

Constructors

CheckQuestion({required String question, required List<String> answers, int attempts = 1})
A question with at least one accepted answer and at least one attempt. Throws an ArgumentError otherwise.
CheckQuestion.fromJson(Object? json)
Reads what toJson wrote. Throws a DocumentFormatException naming what is wrong.
factory

Properties

answers → List<String>
Every answer accepted, as the author wrote it.
final
attempts → int
How many answers a student may give before an accepted one is shown. A count, at least 1.
final
hashCode → int
The hash code for this object.
no setterinherited
question → String
What the student is asked.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

accepts(String given) → bool
Whether given is one of answers, ignoring case and the white space around it: 80 нм is 80 нм.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, Object?>
The question as an experiment step's check writes it, without attempts when it is one.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

fromStepProperties(Map<String, Object?> properties) → CheckQuestion?
The question properties carries under check, or null when it carries none or one without a question or an accepted answer.