SurveyStateProvider class
An InheritedWidget that provides immutable access to survey state.
This widget exposes the current survey state, results, and event handling to descendant widgets. It should not be instantiated directly; instead, use SurveyStateProviderWidget which manages the mutable state and creates this widget on each rebuild.
Access this provider using SurveyStateProvider.of(context).
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- ProxyWidget
- InheritedWidget
- SurveyStateProvider
Constructors
-
SurveyStateProvider({Key? key, required SurveyState state, required Set<
StepResult> results, required DateTime startDate, required StreamController<SurveyState> surveyStateStream, required void onResult(SurveyResult), required void onEvent(SurveyEvent), required StepResult? getStepResultById(String), required Widget child, StepShell? stepShell}) -
Creates a SurveyStateProvider.
const
Properties
- child → Widget
-
The widget below this widget in the tree.
finalinherited
- countSteps → int
-
Returns the total number of steps in the survey.
no setter
- getStepResultById → StepResult? Function(String)
-
Function to retrieve a step result by its identifier.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
Global key for managing the Navigator state.
final
- onEvent → void Function(SurveyEvent)
-
Callback for handling survey events.
final
- onResult → void Function(SurveyResult)
-
Callback invoked when the survey is completed or closed.
final
-
results
→ Set<
StepResult> -
The results collected so far in the survey.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- startDate → DateTime
-
The date and time when the survey was started.
final
- state → SurveyState
-
The current state of the survey.
final
- stepShell → StepShell?
-
Optional custom shell widget builder for wrapping steps.
final
-
surveyStateStream
→ StreamController<
SurveyState> -
Stream controller for broadcasting survey state changes.
final
-
The navigator that manages the task flow.
final
Methods
-
createElement(
) → InheritedElement -
Inflates this configuration to a concrete instance.
inherited
-
currentStepIndex(
Step step) → int -
Returns the index of the given
stepin the survey. -
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
-
updateShouldNotify(
covariant SurveyStateProvider oldWidget) → bool -
Whether the framework should notify widgets that inherit from this widget.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
of(
BuildContext context) → SurveyStateProvider - Retrieves the SurveyStateProvider from the widget tree.