FormValidator class
A class for validating form data using customizable field validators.
The FormValidator class allows defining validation rules for form fields
and then validating input data against those rules. It also handles error
reporting and formatting for easy form validation and feedback display.
Constructors
Properties
-
extraData
↔ Map<
String, Object?> -
Additional data that can be used in validation, not coming directly from the request.
getter/setter pair
- failed ↔ Object
-
The value to indicate a field is invalid.
getter/setter pair
-
fields
↔ Map<
String, List< ValidatorEvent> > -
A map of field names to a list of validator events that will be applied to them.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- name ↔ String
-
The name of the form or validation context. we will use this name in front-end and api key.
getter/setter pair
- rq → Request
-
Gets the current WebRequest from the request context
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- success ↔ Object
-
The value to indicate a field is valid.
getter/setter pair
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
{Map data = const {}}) → Future< bool> - Validates the form data and returns a boolean result.
-
validateAndForm(
{Map data = const {}}) → Future< ({Map< String, dynamic> form, bool result})> - Validates the form data and returns both the result and the validated form structure.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
extractString(
Map< String, Object?> form, [bool allowEmpty = false]) → Map<String, String> -
extractValues(
Map< String, Object?> form) → Map<String, Object?> -
filling(
{required String name, required Map data}) → Future< FormValidator> -
Creates and returns a
FormValidatorinstance with empty validators for all fields indata.