BooleanSchema class

Schema for validating boolean values

Inheritance

Constructors

BooleanSchema({String? description, Map<String, dynamic>? metadata, bool? expectedValue})
const

Properties

description String?
Optional description for documentation purposes
finalinherited
falseValue BooleanSchema
Creates a schema that only accepts false
no setter
hashCode int
The hash code for this object.
no setterinherited
metadata Map<String, dynamic>?
Optional metadata for the schema
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
schemaType String
Gets a string representation of the schema type
no setterinherited
trueValue BooleanSchema
Creates a schema that only accepts true
no setter
type Type
Gets the type that this schema validates to
no setterinherited

Methods

brand<B>() BrandedSchema<bool, B>
Creates a branded schema for nominal typing
inherited
defaultTo(bool defaultValue) Schema<bool>
Creates a new schema that provides a default value
inherited
defaultToComputed(bool defaultValue()) Schema<bool>
Creates a new schema that provides a computed default value
inherited
describe(String description, {Map<String, dynamic>? metadata}) Schema<bool>
Creates a new schema with a description and optional metadata
inherited
fallback(bool fallbackValue) Schema<bool>
Creates a new schema that provides a fallback value
inherited
fallbackComputed(bool fallback(ValidationErrorCollection errors)) Schema<bool>
Creates a new schema that provides a computed fallback value
inherited
falsy() Schema<bool>
Checks if boolean is falsy (false)
isFalse() Schema<bool>
Checks if boolean is false
isTrue() Schema<bool>
Checks if boolean is true
isValid(dynamic input, [List<String> path = const []]) bool
Validates the input and returns true if valid, false otherwise
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
nullable() Schema<bool?>
Creates a new schema that is nullable
inherited
optional() Schema<bool?>
Creates a new schema that is optional (nullable)
inherited
parse(dynamic input, [List<String> path = const []]) bool
Parses the input, throwing an exception if validation fails
inherited
parseAsync(dynamic input, [List<String> path = const []]) Future<bool>
Asynchronously parses the input, throwing an exception if validation fails
inherited
postprocess(bool postprocessor(bool value)) Schema<bool>
Creates a new schema that postprocesses the output
inherited
preprocess<R>(R preprocessor(dynamic input)) Schema<bool>
Creates a new schema that preprocesses the input
inherited
readonly() ReadonlySchema<bool>
Creates a readonly version of this schema
inherited
refine(bool validator(bool value), {String? message, String? code}) Schema<bool>
Creates a new schema that applies additional validation
inherited
refineAsync(Future<bool> validator(bool value), {String? message, String? code}) Schema<bool>
Creates a new schema that applies async validation
inherited
safeParse(dynamic input, [List<String> path = const []]) bool?
Safely parses the input, returning null if validation fails
inherited
safeParseAsync(dynamic input, [List<String> path = const []]) Future<bool?>
Asynchronously and safely parses the input, returning null if validation fails
inherited
toString() String
A string representation of this object.
override
transform<R>(R transformer(bool value)) Schema<R>
Creates a new schema that applies a transformation after validation
inherited
transformAsync<R>(Future<R> transformer(bool value)) Schema<R>
Creates a new schema that applies an async transformation after validation
inherited
truthy() Schema<bool>
Checks if boolean is truthy (true)
validate(dynamic input, [List<String> path = const []]) ValidationResult<bool>
Validates the input and returns a ValidationResult
override
validateAsync(dynamic input, [List<String> path = const []]) Future<ValidationResult<bool>>
Asynchronously validates the input and returns a ValidationResult
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited