ChoiceKey<T extends Object?> class final

Key of a pick-one question (ChoiceQuestion) whose options stand for values of type T.

Reading it gives a ChoiceOf with the chosen option's value.

Inheritance

Constructors

ChoiceKey(String id, ChoiceQuestion question, {required T value(String label)})
Creates a key for question, with value giving the value of each option label.
ChoiceKey.of(String id, Object instructions, {required List<T> options, required String label(T value, int index), Object? describe(T value)?})
Creates a key for a choice over options, in list order.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
id → String
Question id; the key of the question and of its answer.
finalinherited
question → ChoiceQuestion
The question asked under id.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
values → Map<String, T>
The value of each option label, in option order.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

enumOf<E extends Enum>(String id, Object instructions, {required Map<E, Object?> criteria, String label(E value)?}) → ChoiceKey<E>
Creates a key over the enum values of criteria, in map order, each described by its map value.
labels(String id, Object instructions, {required Map<String, Object?> criteria}) → ChoiceKey<String>
Creates a key whose values are the option labels of criteria.