toJson method
Returns a JSON-compatible map representation of this object.
Used by debugging tools and VM service extensions such as
ext.flutter.accessibility.getSemanticsTree.
Implementation
Map<String, Object?> toJson() {
final flagsList = <String>[
for (final SemanticsFlag flag in SemanticsFlag.values)
if (hasFlag(flag)) flag.name,
];
final actionsList = <String>[
for (final SemanticsAction action in SemanticsAction.values)
if (hasAction(action)) action.name,
];
return <String, Object?>{
'label': label,
'value': value,
'hint': hint,
'tooltip': tooltip,
'increasedValue': increasedValue,
'decreasedValue': decreasedValue,
'flags': flagsList,
'actions': actionsList,
'rect': <String, double>{
'left': rect.left,
'top': rect.top,
'width': rect.width,
'height': rect.height,
},
'transform': ?transform?.storage.toList(),
};
}