CockpitWidgetNode.fromJson constructor
Decodes a Widget node from a JSON object.
Implementation
factory CockpitWidgetNode.fromJson(Map<String, Object?> json) {
final boundsJson = json['bounds'] as Map<Object?, Object?>?;
return CockpitWidgetNode(
node: json['node']! as int,
loc: json['loc'] as String?,
parent: json['parent'] as int?,
depth: json['depth']! as int,
type: json['type']! as String,
element: json['element'] as String?,
state: json['state'] as String?,
render: json['render'] as String?,
cockpitId: json['cockpitId'] as String?,
semanticId: json['semanticId'] as String?,
key: json['key'] as String?,
text: json['text'] as String?,
tip: json['tip'] as String?,
route: json['route'] as String?,
visible: json['visible'] as bool? ?? false,
offstage: json['offstage'] as bool? ?? false,
bounds: boundsJson == null
? null
: CockpitWidgetBounds.fromJson(Map<String, Object?>.from(boundsJson)),
scroll: json['scroll'] as int?,
actions: (json['actions'] as List<Object?>? ?? const <Object?>[])
.map(CockpitCommandType.fromJson)
.toList(growable: false),
props: (json['props'] as List<Object?>? ?? const <Object?>[])
.cast<Map<Object?, Object?>>()
.map(
(property) => CockpitWidgetProperty.fromJson(
Map<String, Object?>.from(property),
),
)
.toList(growable: false),
);
}