TypeValidator class
Validates that a value matches one of the JSON Schema type strings.
Supports both the single-string form (TypeValidator('string')) and the
array form (TypeValidator.fromList(['string', 'null'])) as required by
JSON Schema spec ยง6.1.1. In the array form the value is valid if it
matches any of the listed types (logical OR).
Supported types: string, number, integer, boolean, array,
object, null.
- Implemented types
Constructors
- TypeValidator(String type)
-
Creates a validator that accepts a single
typestring. -
TypeValidator.fromList(List<
String> types) -
Creates a validator that accepts any of
types(array form).
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- name → String
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → String
-
The expected JSON Schema type string, or a comma-joined list for the
array form (used for equality and hashing only).
final
-
types
→ List<
String> -
All accepted type strings.
final
Methods
-
call(
dynamic input) → bool -
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override