Map<String, dynamic> toJson() { final type = this.type; final data = this.data; return { 'Type': type.toValue(), if (data != null) 'Data': data, }; }