toJson method

  1. @override
Map<String, dynamic> toJson()
override

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,
  };
}