FormRule class

One thing a value has to satisfy.

Built from the named constructors rather than by hand: each carries a message of its own where you give one and the kit's own words in eleven languages where you do not.

rules: const [FormRule.required(), FormRule.email()]
Annotations

Constructors

FormRule.against(FormCrossValidator validator, {String? message, bool warningOnly = false})
A rule of your own that may read the whole form.
const
FormRule.custom(FormValidator validator, {String? message, bool warningOnly = false})
A rule of your own: anything that can say what is wrong, or nothing.
const
FormRule.email({String? message, bool warningOnly = false})
The value has to look like an email address.
const
FormRule.matches(String other, {String? message, bool warningOnly = false})
Anything you like, including something that has to be asked of a server.
const
FormRule.max(int count, {String? message, bool warningOnly = false})
The value has to have at most count characters or items, or be at most that number.
const
FormRule.min(int count, {String? message, bool warningOnly = false})
The value has to have at least count characters or items, or be at least that number.
const
FormRule.pattern(RegExp pattern, {String? message, bool warningOnly = false})
The value has to match pattern.
const
FormRule.required({String? message, bool warningOnly = false})
The value has to be there: not null, not an empty string, not an empty list, and not a false checkbox.
const
FormRule.url({String? message, bool warningOnly = false})
The value has to look like a web address.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
message → String?
What to say when the value does not satisfy this rule.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
warningOnly → bool
Whether failing this rule is a caution rather than a refusal: the field is marked, and the form still submits.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited