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<T>> validators) ValidatorFn<T>
Runs every validator in validators and returns the first error, or null if all pass. This is the default behaviour of FormControl.validate() — use compose when you want to build a single ValidatorFn from multiple validators to pass into a constructor or reuse across controls.
composeOr<T>(List<ValidatorFn<T>> validators) ValidatorFn<T>
Runs every validator in validators and returns null if any passes (logical OR). Returns the last error if all fail.
emailValidator(String? value) String?
Validates that a String value 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 String length ≤ length.
maxValue<T extends num>(T maxValue) ValidatorFn<T>
Returns a validator that checks a num value ≤ maxValue.
minLength(int length) ValidatorFn<String>
Returns a validator that checks String length ≥ length.
minValue<T extends num>(T minValue) ValidatorFn<T>
Returns a validator that checks a num value ≥ minValue.
pattern(RegExp regExp, {String? message}) ValidatorFn<String>
Returns a validator that checks a String value against regExp.
requiredTrueValidator(bool? value) String?
Validates that value is true. Typically used with FormControl<bool> for "I agree" checkboxes.
requiredValidator(dynamic value) String?
Validates that value is non-null and non-empty (for String, Iterable, List, Set, and Map).

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)