McpIcon class final

An optionally-sized icon that can be displayed in a user interface.

Revisions: 2025-11-25, 2026-07-28, ext-tasks/2026-07-28.

Inheritance

Constructors

McpIcon({String? mimeType, List<String>? sizes, required String src, McpIconTheme? theme, Map<String, Object?>? extra})
McpIcon.fromJson(Map<String, Object?> json)
Wraps json as received; nothing is dropped.

Properties

extra → Map<String, Object?>
Keys outside the schema (newer revisions, extensions, applications).
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
mimeType → String?
Optional MIME type override if the source MIME type is missing or generic. For example: "image/png", "image/jpeg", or "image/svg+xml".
no setter
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 setteroverride
sizes → List<String>?
Optional array of strings that specify sizes at which the icon can be used. Each string should be in WxH format (e.g., "48x48", "96x96") or "any" for scalable formats like SVG.
no setter
src → String
A standard URI pointing to an icon resource. May be an HTTP/HTTPS URL or a data: URI with Base64-encoded image data.
no setter
theme → McpIconTheme?
Optional specifier for the theme this icon is designed for. "light" indicates the icon is designed to be used with a light background, and "dark" indicates the icon is designed to be used with a dark background.
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.
inherited
$required<T>(String key, T read(Object? value, String path)) → T
Required property key, converted by read.
inherited
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.
override
copyWith({String? mimeType, List<String>? sizes, String? src, McpIconTheme? theme}) → McpIcon
A copy with the given properties replaced; everything else, unknown keys included, is kept.
has(String key) → bool
Whether key is present (a null value counts as present).
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, Object?>
The JSON form of this value.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Constants

keys → const Set<String>