NexusSurveyController class
Drives one survey: holds answers, step position, validity, and submit/dismiss.
This is the seam for custom UIs — pass your own widget to the overlay and
drive it entirely from this controller (currentQuestion, setAnswer,
next, back, complete, dismiss, progress). It's a ChangeNotifier,
so rebuild on changes.
- Inheritance
-
- Object
- ChangeNotifier
- NexusSurveyController
Constructors
- NexusSurveyController(NexusSurvey survey, SurveySubmit _submit)
Properties
-
answers
→ Map<
String, Object?> -
Answers keyed by question id (value type depends on question type).
final
- canAdvance → bool
-
Whether the current (required) question has a valid answer.
no setter
- currentQuestion → NexusSurveyQuestion?
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isDone → bool
-
no setter
- isLast → bool
-
no setter
- isSubmitting → bool
-
no setter
- onClose ↔ VoidCallback?
-
Wired by the overlay to remove the survey from the screen. Call close
from your UI when you're done presenting (e.g. after a thank-you).
getter/setter pair
- progress → double
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- step → int
-
no setter
- survey → NexusSurvey
-
final
- totalSteps → int
-
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
answerFor(
String questionId) → Object? -
back(
) → void -
close(
) → void -
complete(
) → Future< void> -
dismiss(
) → Future< void> -
dispose(
) → void -
Discards any resources used by the object.
inherited
-
next(
) → Future< void> - Advance to the next question, or complete on the last.
-
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
-
setAnswer(
String questionId, Object? value) → void -
toggleChoice(
String questionId, String value) → void - Toggle a value within a multi-select answer.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited