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.
Constructors
- SizeRule()
- Creates a size rule.
Properties
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
numericis true. -
sizeOf(
dynamic value, {required bool numeric}) → (num, String)? -
The size of
valueand the message type it was measured as (numeric,stringorlist), ornullfor 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