semantic_tree_extension 1.1.0
semantic_tree_extension: ^1.1.0 copied to clipboard
A Flutter DevTools extension to inspect and visualize the SemanticsTree in real time.
semantic_tree_extension #
A Flutter DevTools extension to inspect, audit, and visualize the SemanticsTree of a running Flutter application in real time.
Screenshots #
| SemanticsTree Inspector & Widget Source | Accessibility Audit, Quick Fixes & Live Highlight |
|---|---|
![]() |
![]() |
Features #
- Hybrid data source:
- Structured JSON mode (recommended): Call
SemanticTreeExtension.ensureInitialized()inmain()to registerext.semantic_tree_extension.getSemanticsTree, automatically enable semantics on demand, and stream the full structuredSemanticsNodetree. - Zero-config fallback mode: If
ensureInitialized()is not called, the extension automatically falls back to Flutter's built-inext.flutter.debugDumpSemanticsTreeInTraversalOrderservice extension and parses the output.
- Structured JSON mode (recommended): Call
- Interactive Split-View UI:
- Left pane: collapsible SemanticsTree with traversal order, node IDs, widget names, labels, and compact flag/action badges.
- Right pane: detailed property inspector (
label,value,hint,tooltip,globalRect,localRect,flags,actions,tags,textDirection) and widget source location.
- Accessibility Audit & Quick Fixes:
- Automatic detection of common accessibility issues (missing labels, small tap targets, duplicate interactive labels) with copyable Flutter quick-fix snippets.
- Live Highlight Overlay & Traversal Order:
- Highlight semantic nodes directly on the running app and switch between
TraversalandHit Testorder, orEffectiveandRawtree views.
- Highlight semantic nodes directly on the running app and switch between
Getting started #
- Flutter SDK:
>= 3.24.0 - Dart SDK:
^3.12.2
Add semantic_tree_extension to your pubspec.yaml:
flutter pub add semantic_tree_extension
Or manually:
dependencies:
semantic_tree_extension: ^1.0.0
Note:
SemanticTreeExtension.ensureInitialized()is a no-op in release mode (kReleaseMode), so it is safe to leave inmain().
Usage #
Optionally initialize the structured JSON service extension in main() to enable live on-device highlighting, widget source resolution, and automatic semantics activation:
import 'package:flutter/material.dart';
import 'package:semantic_tree_extension/semantic_tree_extension.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
SemanticTreeExtension.ensureInitialized();
runApp(const MyApp());
}
Then run your app in debug or profile mode and open the semantic_tree_extension tab in Flutter DevTools.
Additional information #
- Issues & Feature Requests: GitHub Issues
- License: MIT
Development #
Rebuild and copy the DevTools extension web assets into extension/devtools/build/:
cd devtools_extension
dart run devtools_extensions build_and_copy --source=. --dest=../extension/devtools
dart run devtools_extensions validate --package=..


