toJson method
Implementation
@override
Map<String, dynamic> toJson() {
final color = this.color;
final size = this.size;
return {
'className': className,
if (color != null) 'color': color.toJson(),
if (size != null) 'size': size,
};
}