QuestionsModel class
Constructors
-
QuestionsModel({required String question, required String key, String? validationMessage, QuestionFieldType? type, List<
String> ? options, QuestionOptionsPresentation? optionsPresentation, int? optionsChipMaxCount, String? optionsSheetTitle, Future<String?> onValidate(String answer)?}) -
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → String
-
The key to store the answer in the data map.
final
-
onValidate
→ Future<
String?> Function(String answer)? -
Optional async callback for custom validation after the AI accepts the answer.
final
-
options
→ List<
String> ? -
Optional fixed choices for this question. When non-empty, the chat shows
chips or a searchable sheet (see optionsPresentation); the chosen string
is sent to the model. The AI is instructed to accept only those values.
final
- optionsChipMaxCount → int?
-
Overrides the automatic chip threshold (only used when optionsPresentation
is null or QuestionOptionsPresentation.automatic).
final
- optionsPresentation → QuestionOptionsPresentation?
-
How to show options. Null means QuestionOptionsPresentation.automatic:
chips if the count is at most optionsChipMaxCount (default
kDefaultOptionsChipMaxCount), otherwise a searchable bottom sheet.
final
- optionsSheetTitle → String?
-
Title on the searchable sheet (e.g.
Select country).final - question → String
-
The question to ask the user.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → QuestionFieldType?
-
Optional hint for how to interpret answers (text vs numeric, etc.).
final
- validationMessage → String?
-
Custom instructions for the AI on how to judge this answer (injected into the system prompt).
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
-
normalizeOptionsList(
List< String> ? raw) → List<String> - Trim, drop empty entries, and dedupe by trimmed value (first occurrence wins).
-
useSearchableSheetForOptions(
{required List< String> normalized, QuestionOptionsPresentation? presentation, int? chipMaxCount}) → bool - Whether the UI should use the searchable sheet for this normalized option list.
Constants
- kDefaultOptionsChipMaxCount → const int
- Default max options shown as inline chips before using a searchable sheet.