InjectedFormField<T> class Null safety

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 :


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
   listenTo: myCheckBox,
   builder: (value, onChanged) {
     return CheckboxListTile(
       value: value,
       onChanged: onChanged,
       title: Text('I accept the licence'),




autoDisposeWhenNotUsed bool
read-only, inherited
error ↔ dynamic
The error
read / write, inherited-getter
focusNode FocusNode
Get the focus node for this FormField
hasData bool
The state is mutated successfully.
read-only, inherited
hasError bool
The stats has error
read-only, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
hasObservers bool
Whether the state has observers
read-only, inherited
isActive bool
Whether the state is active or not. [...]
read-only, inherited
isDone bool
The state is mutated using a stream and the stream is done.
read-only, inherited
isEnabled bool
If false the associated TextField is disabled.
read / write
isIdle bool
The state is initialized and never mutated.
read-only, inherited
isReadOnly bool
If true the TextField is clickable and selectable but not editable.
read / write
isValid bool
Whether it passes the validation test
isWaiting bool
The state is waiting for and asynchronous task to end.
read-only, inherited
oldSnapState SnapState<T>
read-only, inherited
onChanged ↔ void Function(T? v)
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
snapState SnapState<T>
A snap representation of the state
read / write, inherited
state → T
read-only, inherited
stateAsync Future<T>
It is a future of the state. The future is active if the state is on the isWaiting status.
read-only, inherited
value ↔ T
read / write


dispose() → void
Dispose the state.
initializeState() FutureOr<T>
Initialize the state
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
notify() → void
Notify observers
onAll<R>({R onIdle()?, required R onWaiting()?, required R onError(dynamic error, VoidCallback refreshError)?, required R onData(T data)}) → R
onOrElse<R>({R onIdle()?, R onWaiting()?, R onError(dynamic error, VoidCallback refreshError)?, R onData(T data)?, required R orElse(T data)}) → R
reset() → void
toString() String
A string representation of this object. [...]
validate() bool
Invoke field validators and return true if the field is valid.


operator ==(Object other) bool
The equality operator. [...]