ezy_form library
Easy Form - handle form in flutter with ease
"Easy Form" is a Flutter package designed to simplify the handling of forms within Flutter applications. It offers a streamlined and efficient approach to form management, including features such as form validation, data input handling, error reporting, and state management. This package allows developers to create interactive and dynamic forms easily and efficiently.
Classes
-
EzyFormArrayControl<
TFC> - A widget to consume a FormArrayControl.
- EzyFormConsumer
- Consume a direct FormGroup
-
EzyFormControl<
T> - A widget to consume a FormControl.
-
EzyFormControlWatcher<
T> - Watches a single FormControl and rebuilds whenever its value changes.
- EzyFormGroupArrayControl
- A widget to consume a FormGroupArray.
-
EzyFormWatcher<
R> - Watches the entire FormGroup and rebuilds when any control changes, but only passes the result of a selector function to the builder.
- EzyFormWidget
- A widget to consume a FormGroup
-
FormArrayControl<
T> - A FormArrayControl is a collection of FormControl.
-
FormControl<
T> - A FormControl represents a form control.
- FormGroup
- A FormGroup represents a group of FormControls.
- FormGroupArray
- A FormGroupArray holds a list of FormGroups — each child is a full form group with its own named fields, types, and validators.
- FormNode
- Marker interface for types that can appear as values in a FormGroup's control map.
Functions
-
compose<
T> (List< ValidatorFn< validators) → ValidatorFn<T> >T> -
Runs every validator in
validatorsand returns the first error, ornullif all pass. This is the default behaviour ofFormControl.validate()— usecomposewhen you want to build a singleValidatorFnfrom multiple validators to pass into a constructor or reuse across controls. -
composeOr<
T> (List< ValidatorFn< validators) → ValidatorFn<T> >T> -
Runs every validator in
validatorsand returnsnullif any passes (logical OR). Returns the last error if all fail. -
emailValidator(
String? value) → String? -
Validates that a
Stringvalue matches a basic email pattern. -
equalTo<
T> (FormControl< T> other, {String? message}) → ValidatorFn<T> -
Returns a validator that checks this control's value equals
other's value. Useful for "confirm password" fields. -
maxLength(
int length) → ValidatorFn< String> -
Returns a validator that checks
Stringlength ≤length. -
maxValue<
T extends num> (T maxValue) → ValidatorFn< T> -
Returns a validator that checks a
numvalue ≤maxValue. -
minLength(
int length) → ValidatorFn< String> -
Returns a validator that checks
Stringlength ≥length. -
minValue<
T extends num> (T minValue) → ValidatorFn< T> -
Returns a validator that checks a
numvalue ≥minValue. -
pattern(
RegExp regExp, {String? message}) → ValidatorFn< String> -
Returns a validator that checks a
Stringvalue againstregExp. -
requiredTrueValidator(
bool? value) → String? -
Validates that
valueistrue. Typically used withFormControl<bool>for "I agree" checkboxes. -
requiredValidator(
dynamic value) → String? -
Validates that
valueis non-null and non-empty (forString,Iterable,List,Set, andMap).
Typedefs
-
ArrayValidatorFn<
T> = String? Function(List< T?> ? value) - Signature for validators applied to a FormArrayControl as a whole.
-
AsyncValidatorFn<
T> = Future< String?> Function(T? value) - Signature for asynchronous validators on a FormControl.
-
GroupArrayValidatorFn
= String? Function(List<
FormGroup> ? groups) - A validator function applied to the array of groups as a whole.
-
ValidatorFn<
T> = String? Function(T? value)