NumberMust class
A Validator that validates a number field. This includes:
NumberMust provides numerous constraints that can be imposed on the number field.
Constraints can be chained together via the cascade operator ..
.
Constraints that come first take precedence.
Example:
Former(
form: ...
schema: MySchema(
someIntField: NumberMust()..beWithin(0, 10)
)
)
In the above snippet, the NumberMust validator ensures that
someIntField
must be within 0 and 10, inclusive on both ends.
Constructors
Properties
Methods
-
beAtLeast(
num min, [String? errorMessage]) → void -
Instructs NumberMust to make sure the given number
is not smaller than
min
. -
beAtMost(
num max, [String? errorMessage]) → void -
Instructs NumberMust to make sure the given number
is not bigger than
max
. -
beInteger(
[String? errorMessage]) → void - Instructs NumberMust to make sure the given number is an integer, i.e. no decimal places.
-
beNegative(
[String? errorMessage]) → void - Instructs NumberMust to make sure the given number is negative.
-
bePositive(
[String? errorMessage]) → void - Instructs NumberMust to make sure the given number is positive.
-
beWithin(
num min, num max, [String? errorMessage]) → void -
Instructs NumberMust to make sure the given number
is within the range
min
andmax
, both end inclusive. -
exist(
[String? errorMessage]) → void - Instructs NumberMust to make sure the given value is not null.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
num? value) → bool -
Validates
value
. Returns whether the value is valid.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited