SizeRule class abstract

A rule that compares a value's size: a number's value, a string's length, or a list's item count.

Mirrors Laravel's getSize: a string is read as a NUMBER only when the same attribute also carries a numeric rule (Numeric, Integer), and as a LENGTH otherwise. Form input is always a string, so the rule list has to decide: [Numeric(), Max(100)] refuses "500", while [Between(8, 64)] on a password accepts "12345678". A rule cannot see its siblings, so Validator and FormValidator pass the answer in through passesSized; passes alone sizes a string by its length.

Inheritance
Implementers

Constructors

SizeRule()
Creates a size rule.

Properties

hashCode → int
The hash code for this object.
no setterinherited
name → String
The short name this rule is known by in a messages override map.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

message() → String
Get the validation error message.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
params() → Map<String, dynamic>
Get the replacement parameters for the message.
inherited
passes(String attribute, dynamic value, Map<String, dynamic> data) → bool
Determine if the validation rule passes.
override
passesSized(String attribute, dynamic value, Map<String, dynamic> data, {required bool numeric}) → bool
Determine if the rule passes, sizing a numeric string by value when numeric is true.
sizeOf(dynamic value, {required bool numeric}) → (num, String)?
The size of value and the message type it was measured as (numeric, string or list), or null for a value no size rule can measure.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

numericIn(Iterable<Rule> rules) → bool
Whether rules make an attribute numeric, so its strings are sized by value.