toJson method
Implementation
Map<String, Object?> toJson() => {
'id': id,
'role': role,
if (parentId != null) 'parentId': parentId,
if (label.isNotEmpty) 'label': label,
if (!protected && value != null) 'value': value,
if (hint != null) 'hint': hint,
if (!enabled) 'enabled': false,
if (selected != null) 'selected': selected,
if (checked != null) 'checked': checked,
if (protected) 'protected': true,
if (maxLength != null) 'maxLength': maxLength,
if (actions.isNotEmpty) 'actions': actions.map((a) => a.name).toList(),
};