SurveyController class

Holds the in-progress state of one survey showing: the answers collected so far, the position in the (possibly branching) node graph, and the back-stack for the Back button.

A ChangeNotifier port of the Android SurveyViewModel. Lives for the lifetime of one showing so answers survive rebuilds.

Inheritance

Constructors

SurveyController(SurveyConfigModel survey)

Properties

answers Map<String, SurveyAnswer>
nodeId → answer.
final
canGoBack bool
no setter
currentBlock SurveyBlock?
no setter
currentNode SurveyNode?
no setter
currentNodeId String
no setter
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isComplete bool
no setter
progress double
Coarse progress estimate based on traversal depth, not graph topology.
no setter
progressStep int
Respondent traversal depth (1-based) — the number of nodes reached so far, accounting for back navigation. Mirrors Android's SurveyViewModel progressStep and is reported as analytics item_index.
no setter
redirectUrl String?
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
survey SurveyConfigModel
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
advance() → void
Records the current answer and moves to the branching-decided next node.
back() → void
canAdvance() bool
Whether the current node may be left — required questions must be answered.
dispose() → void
Discards any resources used by the object.
inherited
nextBlockIsResultPage() bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
responsePayload() Map<String, dynamic>
The collected answers as a serialisable map, for the Completed event.
setAnswer(String nodeId, SurveyAnswer answer) → void
toString() String
A string representation of this object.
inherited

Operators

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