TestStateBuilder<T> class
Test-friendly version of StateBuilder with enhanced tracking and control capabilities.
This builder provides additional features for testing:
- Synchronous state updates for predictable testing
- Comprehensive change tracking and verification
- Manual control over rebuild timing
- Error injection and testing capabilities
- Performance metrics collection
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- TestStateBuilder
Constructors
-
TestStateBuilder({Key? key, required ObservableState<
T> state, required Widget builder(BuildContext, T), Widget errorBuilder(BuildContext, StateException)?, EqualityChecker<T> ? equalityChecker, bool enableAutoRebuild = true, bool enableChangeTracking = true, String? testKey, StateChangeTracker? changeTracker}) -
const
Properties
- builder → Widget Function(BuildContext, T)
-
The builder function that creates the widget tree.
final
- changeTracker → StateChangeTracker?
-
Optional change tracker for external tracking.
final
- enableAutoRebuild → bool
-
Whether to enable automatic rebuilds (false for manual control in tests).
final
- enableChangeTracking → bool
-
Whether to track all state changes for verification.
final
-
equalityChecker
→ EqualityChecker<
T> ? -
Custom equality checker for testing equality behavior.
final
- errorBuilder → Widget Function(BuildContext, StateException)?
-
Optional error builder for testing error scenarios.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
state
→ ObservableState<
T> -
The state to observe and build from.
final
- testKey → String?
-
Key for identifying this builder in tests.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< TestStateBuilder< T> > -
Creates the mutable state for this widget at a given location in the tree.
override
-
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
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited