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 :

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'),
     );
   },
  ),

Constructors

InjectedFormField()

Properties

autoDisposeWhenNotUsed bool
read-only, inherited
error ↔ dynamic
The error
read / write, inherited-getter
focusNode FocusNode
Get the focus node for this FormField
read-only
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
read-only
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

Methods

dispose() → void
Dispose the state.
inherited
initializeState() FutureOr<T>
Initialize the state
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
notify() → void
Notify observers
inherited
onAll<R>({R onIdle()?, required R onWaiting()?, required R onError(dynamic error, VoidCallback refreshError)?, required R onData(T data)}) → R
inherited
onOrElse<R>({R onIdle()?, R onWaiting()?, R onError(dynamic error, VoidCallback refreshError)?, R onData(T data)?, required R orElse(T data)}) → R
inherited
reset() → void
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