Map<String, Object?> toJson() { var key = this.key; final json = <String, Object?>{}; if (key != null) { json[r'key'] = key.value; } return json; }