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