enum MediaAttachmentType { image, video, gifv, audio, unknown, } class MediaAttachmentModel { late MediaAttachmentType type; late String url; late String previewUrl; late String? description; MediaAttachmentModel.fromJson(Map json) { url = json["url"]; previewUrl = json["preview_url"]; type = MediaAttachmentType.values.firstWhere((element) => // ignore: prefer_interpolation_to_compose_strings element.toString() == "MediaAttachmentType." + json["type"]); description = json["description"]; } }