toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final unit = this.unit;
  final value = this.value;
  return {
    if (unit != null) 'unit': unit.toValue(),
    if (value != null) 'value': value,
  };
}