FlutterAgentation class

The top-level wrapper widget for FlutterAgentation visual feedback tooling.

Designed to match the official Agentation architecture. Supports:

  • Zero-config local mode: Just wrap with <FlutterAgentation(child: child)>
  • MCP Agent Sync mode: Provide endpoint: "http://localhost:4747" to stream to AI agents
  • Submit & Webhooks: Provide onSubmit or webhookUrl to enable toolbar Send button

Place at the builder level of your MaterialApp or root application:

MaterialApp(
  builder: (context, child) => FlutterAgentation(child: child),
  home: const MyHomePage(),
)
Inheritance

Constructors

FlutterAgentation({Key? key, Widget? child, AgentationController? controller, String? endpoint, String? sessionId, void onSessionCreated(String sessionId)?, String? webhookUrl, String? appName, bool copyToClipboard = true, bool enableKeyboardShortcuts = true, bool debugOnly = true, void onAnnotationAdd(Annotation annotation)?, void onAnnotationDelete(Annotation annotation)?, void onAnnotationUpdate(Annotation annotation)?, void onAnnotationsClear(List<Annotation> annotations)?, void onCopy(String sessionId)?, FutureOr<void> onSubmit(String output, List<Annotation> annotations)?, void onOpenSource(String sessionId)?, OutputDetailLevel? initialDetailLevel, CopyFormat? copyFormat, bool showToolbar = true, bool initialToolbarMinimized = true, bool? initialCollapsed, bool? mcpEnabled, int? mcpPort, Alignment initialToolbarAlignment = Alignment.bottomRight, HighlightStyle highlightStyle = const HighlightStyle(), void onWidgetSelected(WidgetInspectionResult result)?})
const

Properties

appName → String?
Optional app name included in copied and submitted feedback header.
final
child → Widget?
The root application child widget tree.
final
controller → AgentationController?
Optional external controller for programmatic inspection control.
final
copyFormat → CopyFormat?
Format for copied output (markdown, feedback, json, source, attributes).
final
copyToClipboard → bool
Whether to copy to clipboard when the copy button is clicked. Defaults to true.
final
debugOnly → bool
Whether Flutter Agentation is restricted to debug mode only.
final
enableKeyboardShortcuts → bool
Enable global keyboard shortcuts. Defaults to true.
final
endpoint → String?
Server URL for sync (e.g., "http://localhost:4747"). If omitted, operates in local mode.
final
hashCode → int
The hash code for this object.
no setterinherited
highlightStyle → HighlightStyle
Styling configuration for bounding boxes and identification badges.
final
initialCollapsed → bool?
Deprecated alias for initialToolbarMinimized.
final
initialDetailLevel → OutputDetailLevel?
Initial detail level for markdown export formatting.
final
initialToolbarAlignment → Alignment
Initial screen quadrant alignment for the floating toolbar.
final
initialToolbarMinimized → bool
Whether the floating toolbar starts minimized.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
mcpEnabled → bool?
Whether the embedded MCP (Model Context Protocol) server is enabled.
final
mcpPort → int?
The port on which the embedded MCP server listens (default: 4747).
final
onAnnotationAdd → void Function(Annotation annotation)?
Callback fired when an annotation is created.
final
onAnnotationDelete → void Function(Annotation annotation)?
Callback fired when an annotation is deleted.
final
onAnnotationsClear → void Function(List<Annotation> annotations)?
Callback fired when all annotations are cleared.
final
onAnnotationUpdate → void Function(Annotation annotation)?
Callback fired when an annotation comment or message is edited.
final
onCopy → void Function(String sessionId)?
Callback fired after a Copy attempt with formatted output.
final
onOpenSource → void Function(String sessionId)?
Callback fired when "Open in editor" is clicked for source code navigation.
final
onSessionCreated → void Function(String sessionId)?
Called when a new session is created.
final
onSubmit → FutureOr<void> Function(String output, List<Annotation> annotations)?
Callback fired when "Send Annotations" is clicked.
final
onWidgetSelected → void Function(WidgetInspectionResult result)?
Optional callback invoked whenever a widget is selected.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sessionId → String?
Pre-existing session ID to join. If not provided with endpoint, creates a new session.
final
showToolbar → bool
Whether to display the floating on-screen toolbar.
final
webhookUrl → String?
Webhook URL to receive annotation events.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<FlutterAgentation>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

debugModeOverride ↔ bool?
For internal testing purposes only. Allows overriding kDebugMode in widget tests.
getter/setter pair

Static Methods

builder({Key? key, AgentationController? controller, String? endpoint, String? sessionId, void onSessionCreated(String sessionId)?, String? webhookUrl, String? appName, bool copyToClipboard = true, bool enableKeyboardShortcuts = true, bool debugOnly = true, void onAnnotationAdd(Annotation annotation)?, void onAnnotationDelete(Annotation annotation)?, void onAnnotationUpdate(Annotation annotation)?, void onAnnotationsClear(List<Annotation> annotations)?, void onCopy(String sessionId)?, FutureOr<void> onSubmit(String output, List<Annotation> annotations)?, void onOpenSource(String sessionId)?, OutputDetailLevel? initialDetailLevel, CopyFormat? copyFormat, bool showToolbar = true, bool initialToolbarMinimized = true, bool? initialCollapsed, bool? mcpEnabled, int? mcpPort, Alignment initialToolbarAlignment = Alignment.bottomRight, HighlightStyle highlightStyle = const HighlightStyle(), void onWidgetSelected(WidgetInspectionResult result)?}) → TransitionBuilder
Creates a TransitionBuilder for direct use in MaterialApp.builder or WidgetsApp.builder.