InjectedFormField<T> class abstract

Inject form inputs other than for text editing

This injected state abstracts the best practices to come out with a simple, clean, and testable approach deal with form inputs and form validation.

See also :

Example:

In most cases, any input form widget have a value and onChanged properties. You must set these properties to the exposed value and onChanged of OnFormFieldBuilder. This is an example of CheckBox input field

  final myCheckBox = RM.injectFormField<bool>(false);

  //In the widget tree
  OnFormFieldBuilder<bool>(
   listenTo: myCheckBox,
   builder: (value, onChanged) {
     return CheckboxListTile(
       value: value,
       onChanged: onChanged,
       title: Text('I accept the licence'),
     );
   },
  ),
Implemented types
Implementers

Constructors

InjectedFormField()

Properties

customStatus Object?
Custom status of the state. Set manually to mark the state with a particular tag to be used in your logic.
getter/setter pairinherited
error ↔ dynamic
The error
getter/setter pairinherited-getter
focusNode FocusNode
Get the focus node for this FormField
no setter
hasData bool
The state is mutated successfully.
no setterinherited
hasError bool
The stats has error
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hasObservers bool
Whether the state has listeners or not
no setterinherited
isDirty bool
is the field dirty (its value changed and not submitted yet)
no setter
isDone bool
The state is mutated using a stream and the stream is done.
no setterinherited
isEnabled bool
If false the associated TextField is disabled.
getter/setter pair
isIdle bool
The state is initialized and never mutated.
no setterinherited
isReadOnly bool
If true the TextField is clickable and selectable but not editable.
getter/setter pair
isValid bool
Whether it passes the validation test
no setter
isWaiting bool
The state is waiting for and asynchronous task to end.
no setterinherited
onChanged ↔ void Function(T? v)
Called when the value of the field changed
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
snapState SnapState<T>
A snap representation of the state
no setterinherited
value ↔ T
The value of the Field
getter/setter pair

Methods

addCleaner(VoidCallback listener) VoidCallback
Add a callback to be executed when the state is disposed of.
inherited
addObserver({required ObserveReactiveModel listener, bool shouldAutoClean = false, bool isSideEffects = true}) VoidCallback
Add observer to this state.
inherited
cleanState() → void
Clean the state
inherited
dispose() → void
Dispose the state
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notify() → void
Notify observers
inherited
reset() → void
reset the field
toString() String
A string representation of this object.
inherited
validate() bool
Invoke field validators and return true if the field is valid.

Operators

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