McpObject class abstract

Base of every generated object type.

Implemented types

Constructors

McpObject.build(Map<String, Object?> json)
Built by a generated constructor from typed values already encoded.
McpObject.fromJson(Map<String, Object?> json)
Wraps json as received. The map is copied, so later changes to the caller's map do not reach the model.

Properties

extra → Map<String, Object?>
Keys outside the schema (newer revisions, extensions, applications).
no setter
hashCode → int
The hash code for this object.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
schemaKeys → Set<String>
Property names the schema defines for this type.
no setter

Methods

$optional<T>(String key, T? read(Object? value, String path)) → T?
Optional property key, converted by read; null when absent or null.
$required<T>(String key, T read(Object? value, String path)) → T
Required property key, converted by read.
check() → List<String>
Reads every property this type defines and returns what could not be read (missing required properties, wrong types), nested types included. Empty = the JSON matches the schema's shape for this type.
has(String key) → bool
Whether key is present (a null value counts as present).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, Object?>
The JSON form of this value.
override
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
Equal when the JSON is equal; key order does not matter.
override
operator [](String key) → Object?
The raw JSON value of key.

Static Methods

$check(Object? read()) → List<String>
Runs read for check: a failure becomes its message, a nested model or list of models is checked in turn.