BoolMust class
A Validator that validates a bool field. It provides numerous constraints that can be imposed on the bool field.
Constraints can be chained together via the cascade operator ...
Constraints that come first take precedence.
Example:
Former(
form: ...
schema: MySchema(
someBoolField: BoolMust()..exist()..beTrue(),
)
)
In the above snippet, the BoolMust validator ensures that
someBoolField must exist and must be true.
Constructors
- BoolMust()
Properties
Methods
-
beFalse(
[String? errorMessage]) → void - Instructs BoolMust to make sure the given value is false.
-
beTrue(
[String? errorMessage]) → void - Instructs BoolMust to make sure the given value is true.
-
exist(
[String? errorMessage]) → void - Instructs BoolMust 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(
bool? value) → bool -
Validates
value. Returns whether the value is valid.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited