McpWidgetRegistry class
Registry of testable widgets via MCP.
Every widget that wants to be controlled by Claude must register here with an McpMetadataKey that defines its ID, type, and capabilities.
The registry creates an internal GlobalKey that must be assigned to the widget in the Flutter tree so the executor can obtain its context.
Properties
-
entries
→ Iterable<
MapEntry< String, ({GlobalKey< >State< globalKey, McpMetadataKey metadata})>StatefulWidget> > -
Returns the registry entries for iteration in the executor.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getAllWidgetIds(
) → List< String> - Lists all registered widget IDs.
-
getAllWidgets(
) → List< McpMetadataKey> - Lists all registered widget metadata.
-
getContext(
String id) → BuildContext? - Returns the BuildContext of the mounted widget, or null if not on screen.
-
getGlobalKey(
String id) → GlobalKey< State< ?StatefulWidget> > - Returns the internal GlobalKey to assign to the widget in the tree.
-
getRenderBox(
String id) → RenderBox? - Returns the RenderBox of the widget, needed to calculate position and size.
-
getWidgetMetadata(
String id) → McpMetadataKey? - Returns the metadata of a specific widget.
-
isRegistered(
String id) → bool -
Returns true if the widget with
idis registered. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerWidget(
McpMetadataKey key) → void - Registers a widget and creates its internal GlobalKey.
-
toJson(
{String? screen, String? route}) → Map< String, dynamic> - Generates the context JSON consumed by the external MCP server.
-
toString(
) → String -
A string representation of this object.
inherited
-
unregisterWidget(
String id) → void - Removes a widget from the registry.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → McpWidgetRegistry
-
final