toJson method
As a document writes it.
Implementation
Map<String, Object?> toJson() => <String, Object?>{
'type': type,
'label': ?label,
if (tint case final LinearColor tint)
'tint': <double>[tint.r, tint.g, tint.b],
'fields': <Object?>[for (final field in fields) field.toJson()],
if (components.isNotEmpty) 'components': components.toList(),
};