WidgetInspectorService mixin Null safety
Service used by GUI tools to interact with the WidgetInspector.
Calls to this object are typically made from GUI tools such as the Flutter IntelliJ Plugin using the Dart VM Service. This class uses its own object id and manages object lifecycles itself instead of depending on the object ids specified by the VM Service Protocol because the VM Service Protocol ids expire unpredictably. Object references are tracked in groups so that tools that clients can use dereference all objects in a group with a single operation making it easier to avoid memory leaks.
All methods in this class are appropriate to invoke from debugging tools
using the Observatory service protocol to evaluate Dart expressions of the
form WidgetInspectorService.instance.methodName(arg1, arg2, ...)
. If you
make changes to any instance method of this class you need to verify that
the Flutter IntelliJ Plugin
widget inspector support still works with the changes.
All methods returning String values return JSON.
Properties
- selection → InspectorSelection
-
Ground truth tracking what object(s) are currently selected used by both
GUI tools such as the Flutter IntelliJ Plugin and the WidgetInspector
displayed on the device.
final
- selectionChangedCallback ↔ InspectorSelectionChangedCallback?
-
Callback typically registered by the WidgetInspector to receive
notifications when selection changes.
read / write
-
pubRootDirectories
→ List<
String> ? - the pubRootDirectories that are currently configured for the widget inspector.
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
addPubRootDirectories(
List< String> pubRootDirectories) → void -
Add a list of directories that should be considered part of the local
project.
protected">@protected
-
devToolsInspectorUri(
String inspectorRef) → String -
Returns the DevTools inspector uri for the given vm service connection and
inspector reference.
visibleForTesting">@visibleForTesting
-
disposeAllGroups(
) → void -
Clear all InspectorService object references.
protected">@protectedvisibleForTesting">@visibleForTesting
-
disposeGroup(
String name) → void -
Free all references to objects in a group.
protected">@protected
-
disposeId(
String? id, String groupName) → void -
Remove the object with the specified
id
from the specified object group.protected">@protected -
forceRebuild(
) → Future< void> -
Cause the entire tree to be rebuilt. This is used by development tools
when the application code has changed and is being hot-reloaded, to cause
the widget tree to pick up any changed implementations.
protected">@protected
-
getChildren(
String diagnosticsNodeId, String groupName) → String -
Returns a JSON representation of the children of the DiagnosticsNode
object that
diagnosticsNodeId
references. -
getChildrenDetailsSubtree(
String diagnosticsNodeId, String groupName) → String -
Returns a JSON representation of the children of the DiagnosticsNode
object that
diagnosticsNodeId
references providing information needed for the details subtree view. -
getChildrenSummaryTree(
String diagnosticsNodeId, String groupName) → String -
Returns a JSON representation of the children of the DiagnosticsNode
object that
diagnosticsNodeId
references only including children that were created directly by user code. -
getDetailsSubtree(
String id, String groupName, {int subtreeDepth = 2}) → String -
Returns a JSON representation of the subtree rooted at the
DiagnosticsNode object that
diagnosticsNodeId
references providing information needed for the details subtree view. -
getParentChain(
String id, String groupName) → String -
Returns JSON representing the chain of DiagnosticsNode instances from
root of thee tree to the Element or RenderObject matching
id
.protected">@protected -
getProperties(
String diagnosticsNodeId, String groupName) → String -
Returns a JSON representation of the properties of the DiagnosticsNode
object that
diagnosticsNodeId
references.protected">@protected -
getRootRenderObject(
String groupName) → String -
Returns a JSON representation of the DiagnosticsNode for the root
RenderObject.
protected">@protected
-
getRootWidget(
String groupName) → String - Returns a JSON representation of the DiagnosticsNode for the root Element.
-
getRootWidgetSummaryTree(
String groupName) → String - Returns a JSON representation of the DiagnosticsNode for the root Element showing only nodes that should be included in a summary tree.
-
getSelectedRenderObject(
String previousSelectionId, String groupName) → String -
Returns a DiagnosticsNode representing the currently selected
RenderObject.
protected">@protected
-
getSelectedSummaryWidget(
String previousSelectionId, String groupName) → String - Returns a DiagnosticsNode representing the currently selected Element if the selected Element should be shown in the summary tree otherwise returns the first ancestor of the selected Element shown in the summary tree.
-
getSelectedWidget(
String? previousSelectionId, String groupName) → String -
Returns a DiagnosticsNode representing the currently selected Element.
protected">@protected
-
initServiceExtensions(
RegisterServiceExtensionCallback registerServiceExtensionCallback) → void - Called to register service extensions.
-
isStructuredErrorsEnabled(
) → bool - Whether structured errors are enabled.
-
isWidgetCreationTracked(
) → bool - Returns whether Widget creation locations are available.
-
isWidgetTreeReady(
[String? groupName]) → bool -
Returns whether the application has rendered its first frame and it is
appropriate to display the Widget tree in the inspector.
protected">@protected
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
performReassemble(
) → void - This method is called by WidgetsBinding.performReassemble to flush caches of obsolete values after a hot reload.
-
postEvent(
String eventKind, Map< Object, Object?> eventData) → void -
All events dispatched by a WidgetInspectorService use this method
instead of calling developer.postEvent directly so that tests for
WidgetInspectorService can track which events were dispatched by
overriding this method.
protected">@protected
-
registerServiceExtension(
{required String name, required ServiceExtensionCallback callback}) → void -
Registers a service extension method with the given name (full
name "ext.flutter.inspector.name").
protected">@protected
-
removePubRootDirectories(
List< String> pubRootDirectories) → void -
Remove a list of directories that should no longer be considered part
of the local project.
protected">@protected
-
resetAllState(
) → void - Reset all InspectorService state.
-
resetPubRootDirectories(
) → void -
Resets the list of directories, that should be considered part of the
local project, to the value passed in pubRootDirectories.
protected">@protectedvisibleForTesting">@visibleForTesting
-
screenshot(
Object? object, {required double width, required double height, double margin = 0.0, double maxPixelRatio = 1.0, bool debugPaint = false}) → Future< Image?> -
Captures an image of the current state of an
object
that is a RenderObject or Element.protected">@protected -
setPubRootDirectories(
List< String> pubRootDirectories) → void -
Set the list of directories that should be considered part of the local
project.
Deprecated('Use addPubRootDirectories instead. ' 'This feature was deprecated after v3.1.0-9.0.pre.')">@Deprecated('Use addPubRootDirectories instead. ' 'This feature was deprecated after v3.1.0-9.0.pre.')protected">@protected
-
setSelection(
Object? object, [String? groupName]) → bool -
Set the WidgetInspector selection to the specified
object
if it is a valid object to set as the inspector selection.protected">@protected -
setSelectionById(
String? id, [String? groupName]) → bool -
Set the WidgetInspector selection to the object matching the specified
id if the object is valid object to set as the inspector selection.
protected">@protected
-
toId(
Object? object, String groupName) → String? -
Returns a unique id for
object
that will remain live at least until disposeGroup is called ongroupName
.protected">@protected -
toObject(
String? id, [String? groupName]) → Object? -
Returns the Dart object associated with a reference id.
protected">@protected
-
toObjectForSourceLocation(
String id, [String? groupName]) → Object? -
Returns the object to introspect to determine the source location of an
object's class.
protected">@protected
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance ↔ WidgetInspectorService
-
The current WidgetInspectorService.
protected">@protectedread / write