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