fromJson static method
Implementation
static AttachmentRequest fromJson(Map<String, dynamic> json) {
final type = json['type'] as String;
return switch (type) {
'image' => ImageAttachmentRequest.fromJson(json),
'video' => VideoAttachmentRequest.fromJson(json),
'audio' => AudioAttachmentRequest.fromJson(json),
'file' => FileAttachmentRequest.fromJson(json),
'sticker' => StickerAttachmentRequest.fromJson(json),
'contact' => ContactAttachmentRequest.fromJson(json),
'inline_keyboard' => InlineKeyboardAttachmentRequest.fromJson(json),
'share' => ShareAttachmentRequest.fromJson(json),
'location' => LocationAttachmentRequest.fromJson(json),
_ => throw ArgumentError('Unknown attachment request type: $type'),
};
}