toJson method
Implementation
Map<String, dynamic> toJson() {
return {
'key': key,
if (label != null) 'label': label,
if (options.isNotEmpty) 'options': options.map((o) => o.toJson()).toList(),
if (children.isNotEmpty) 'children': children.map((c) => c.toJson()).toList(),
if (leadsTo != null) 'leadsTo': leadsTo,
if (script != null) 'script': script,
if (ref != null) 'ref': ref,
};
}