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.

Implemented types

Constructors

NumberMust()

Properties

error String
The error message as a result of a failed validation. This is empty if the previous validation is passed.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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 and max, 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