IntSchema class final
Matches JSON integers. Whole-valued doubles such as 5.0 — which some
models emit for integer fields — are accepted and truncated to int.
Properties
- defaultValue → Object?
-
The default supplied when providesDefault is true.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isOptional → bool
-
Whether an object field using this schema may be omitted entirely.
no setterinherited
- maximum → int?
-
final
- minimum → int?
-
final
- providesDefault → bool
-
Whether this schema supplies a default when the value is missing.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
describe(
String description) → Schema< int> -
Attaches a description, included in toJsonSchema. Descriptions are
the main way to tell an LLM what a field means — use them liberally.
inherited
-
max(
int value) → IntSchema -
Requires the value to be at most
value. -
min(
int value) → IntSchema -
Requires the value to be at least
value. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
nullable(
) → Schema< int?> -
Accepts
nullin addition to values matching this schema.inherited -
optional(
) → Schema< int> -
Marks an object field as omittable. When the key is absent the field
is left out of the resulting map (no error is reported).
inherited
-
parse(
Object? input) → int -
Validates a decoded JSON value, throwing SchemaValidationException
on failure.
inherited
-
parseText(
String text) → int -
Extracts JSON from raw LLM
textand validates it, throwing SchemaValidationException on failure.inherited -
positive(
) → IntSchema - Requires a value greater than zero.
-
refine(
bool predicate(int value), {String? message}) → Schema< int> -
Adds a custom check on the validated value.
inherited
-
safeParse(
Object? input) → SchemaResult< int> -
Validates a decoded JSON value. Never throws; returns a
SchemaSuccess or a SchemaFailure carrying every issue found.
inherited
-
safeParseText(
String text) → SchemaResult< int> -
Extracts JSON from raw LLM
textand validates it. Never throws.inherited -
toJsonSchema(
) → Map< String, Object?> -
This schema expressed as a JSON Schema map, suitable for LLM
tool-parameter definitions and structured-output APIs.
override
-
toJsonSchemaString(
{bool pretty = false}) → String -
toJsonSchema encoded as a JSON string.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
transform<
R> (R mapper(int value)) → Schema< R> -
Maps the validated value with
mapper. Exceptions thrown bymapperare converted into validation issues.inherited -
validateAt(
Object? input, List< Object> path) → SchemaResult<int> -
Validates
inputlocated atpathwithin a larger document.override -
withDefault(
int value) → Schema< int> -
Uses
valuewhen the input isnullor the object key is absent.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited