readWidgetTree method
Future<InspectorJson>
readWidgetTree({
- required String groupName,
- bool isSummaryTree = true,
- bool withPreviews = true,
- bool fullDetails = false,
override
Returns the inspector's widget tree as raw DiagnosticsNode JSON.
isSummaryTree: true (the default) filters out framework
internals; false returns the full element tree.
Implementation
@override
Future<InspectorJson> readWidgetTree({
required String groupName,
bool isSummaryTree = true,
bool withPreviews = true,
bool fullDetails = false,
}) async {
var isolate = flutterIsolateId;
_startWarmup(isolate);
final scoped = _scopedLimit;
var limit = scoped == null ? null : scoped * 2;
while (true) {
final resp = await _guard(
() => _vm.service.callServiceExtension(
'ext.flutter.inspector.getRootWidgetTree',
isolateId: flutterIsolateId,
args: InspectorParams.rootWidgetTree(
groupName: groupName,
isSummaryTree: isSummaryTree,
withPreviews: withPreviews,
fullDetails: fullDetails,
),
),
timeout: limit);
final result = (resp.json?['result'] as Map?)?.cast<String, Object?>();
if (result != null) {
_warmupEnds = DateTime.fromMillisecondsSinceEpoch(0);
return result;
}
if (isolate != flutterIsolateId) {
isolate = flutterIsolateId;
_startWarmup(isolate);
}
final remaining = _warmupEnds.difference(DateTime.now());
if (remaining <= Duration.zero) {
throw RuntimeEvalError('getRootWidgetTree', 'response missing `result` map: ${resp.json}');
}
await Future<void>.delayed(const Duration(milliseconds: 250));
limit = remaining < const Duration(seconds: 1) ? const Duration(seconds: 1) : remaining;
}
}