OddValidator class

Ensures the number is odd (its remainder modulo 2 is one).

A non-integer value (e.g. 4.5) is neither even nor odd and fails.

Inheritance

Constructors

OddValidator({required String error, bool ignoreEmptyValues = true})
const

Properties

error String
The error message returned when validation fails.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
ignoreEmptyValues bool
Whether empty input (see isEmpty) short-circuits to "valid".
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(num? value) String?
Validates value: returns null when it is acceptable, error when it is not.
inherited
isEmpty(num value) bool
Whether a non-null value counts as "empty" for this value type.
inherited
isValid(num value) bool
Checks whether a non-empty value satisfies the validation criteria.
override
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