WDynamicController class
Controller for external access to WDynamic state.
Allows reading/writing form values and listening for changes from outside the dynamic widget tree.
final controller = WDynamicController();
// Pre-fill values
controller.setValue('email', 'user@example.com');
// Read values
final email = controller.getValue('email');
// Listen for changes
final dispose = controller.addListener('email', (value) {
print('Email changed: $value');
});
// Clean up
controller.dispose();
Constructors
- WDynamicController()
- Creates a controller with a new internal state.
- WDynamicController.fromState(WDynamicState state)
- Creates a controller wrapping an existing state.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → WDynamicState
-
The internal state store.
final
Methods
-
addListener(
String id, ValueChanged callback) → VoidCallback - Add a listener for a specific id. Returns a dispose function.
-
dispose(
) → void - Dispose the controller and its owned state.
-
getAll(
) → Map< String, dynamic> - Get all current values.
-
getValue(
String id) → dynamic - Get a value by id.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void - Reset all values.
-
setValue(
String id, dynamic value) → void - Set a value by id.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited