toJsonMapIterative method

Map<String, Object?> toJsonMapIterative(
  1. DiagnosticsSerializationDelegate delegate
)

Iteratively serialize the node to a JSON map according to the configuration provided in the DiagnosticsSerializationDelegate.

This is only used when WidgetInspectorServiceExtensions.getRootWidgetTree is called with fullDetails=false. To get the full widget details, including any details provided by subclasses, toJsonMap should be used instead.

See https://github.com/flutter/devtools/issues/8553 for details about this iterative approach.

Implementation

Map<String, Object?> toJsonMapIterative(DiagnosticsSerializationDelegate delegate) {
  final _NodesToJsonifyStack childrenToJsonify =
      ListQueue<(DiagnosticsNode, void Function(_JsonDiagnosticsNode))>();
  _JsonDiagnosticsNode result = <String, Object?>{};
  assert(() {
    result = _toJson(delegate, childrenToJsonify: childrenToJsonify);
    _jsonifyNextNodesInStack(childrenToJsonify, delegate: delegate);
    return true;
  }());
  return result;
}