DynamicFormController class

A controller that manages the state, values, and validation of a DynamicForm.

Inheritance

Constructors

DynamicFormController()

Properties

formData → Map<String, dynamic>
Returns an unmodifiable map containing all current form field values.
no setter
formKey → GlobalKey<FormState>
Global key for the Form widget managed by this controller.
final
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
valueStream → Stream<Map<String, dynamic>>
A stream that emits the current form data whenever a value changes.
no setter

Methods

addCustomValidator(String key, String? fn(dynamic)) → void
Registers a custom validation function globally.
addFieldListener(String key, VoidCallback callback) → void
Adds a listener for changes to a specific field's value.
addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() → void
Discards any resources used by the object.
override
getFieldError(String key) → String?
Retrieves the current error message for a specific field.
getValue(String key) → dynamic
Retrieves the current value of a specific field.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeFieldListener(String key, VoidCallback callback) → void
Removes a listener for changes to a specific field's value.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
reset() → void
Resets the form to its initial state, clearing all values and errors.
setFieldError(String key, String? error) → void
Manually sets an error message for a specific field.
setValue(String key, dynamic value) → void
Updates the value of a specific field and notifies listeners.
submit() → Map<String, dynamic>?
Validates the form and returns the form data if valid, or null if invalid.
toString() → String
A string representation of this object.
inherited
validate() → bool
Triggers the validation of the entire form using the formKey. Returns true if the form is valid, false otherwise.

Operators

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