toJson method
Implementation
Map<String, dynamic> toJson() {
final result = <String, dynamic>{'key': key, 'type': type, 'path': path};
if (name != null) {
result['name'] = name;
}
if (text != null) {
result['text'] = text;
}
if (componentName != null) {
result['component'] = componentName;
}
if (generator != null) {
result['generator'] = generator!.toJson();
}
if (triggerTypes.isNotEmpty) {
result['triggers'] = triggerTypes;
}
if (slots.isNotEmpty) {
result['slots'] = <String, dynamic>{
for (final entry in slots.entries)
entry.key: [for (final child in entry.value) child.toJson()],
};
}
if (children.isNotEmpty) {
result['children'] = [for (final child in children) child.toJson()];
}
return result;
}