Schema<T> class
Defines a schema for validating and constructing objects from JSON data.
The schema contains field definitions that specify how each property in the JSON should be validated and transformed before being passed to the constructor.
Constructors
Properties
-
constructor
→ T Function(Map<
String, dynamic> data) -
Function that constructs an instance of T from validated data.
final
-
fields
→ List<
FieldInfo> -
The field definitions that make up this schema.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
fromJson(
dynamic json) → T - Validates and converts a single JSON object to type T.
-
many(
dynamic json) → List< T> - Validates and converts a list of JSON objects to a list of type T.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
dynamic json, [JsonPath path = const JsonPath.root(), FieldInfo? field]) → T - Validates a JSON object against this schema and constructs an instance of T.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited