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.

Implemented types

Constructors

BoolMust()

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

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