ChatAction.fromJson constructor
a ChatAction return type can be :
- ChatActionTyping
- ChatActionRecordingVideo
- ChatActionUploadingVideo
- ChatActionRecordingVoiceNote
- ChatActionUploadingVoiceNote
- ChatActionUploadingPhoto
- ChatActionUploadingDocument
- ChatActionChoosingSticker
- ChatActionChoosingLocation
- ChatActionChoosingContact
- ChatActionStartPlayingGame
- ChatActionRecordingVideoNote
- ChatActionUploadingVideoNote
- ChatActionWatchingAnimations
- ChatActionCancel
Implementation
factory ChatAction.fromJson(Map<String, dynamic> json) {
switch(json["@type"]) {
case ChatActionTyping.CONSTRUCTOR:
return ChatActionTyping.fromJson(json);
case ChatActionRecordingVideo.CONSTRUCTOR:
return ChatActionRecordingVideo.fromJson(json);
case ChatActionUploadingVideo.CONSTRUCTOR:
return ChatActionUploadingVideo.fromJson(json);
case ChatActionRecordingVoiceNote.CONSTRUCTOR:
return ChatActionRecordingVoiceNote.fromJson(json);
case ChatActionUploadingVoiceNote.CONSTRUCTOR:
return ChatActionUploadingVoiceNote.fromJson(json);
case ChatActionUploadingPhoto.CONSTRUCTOR:
return ChatActionUploadingPhoto.fromJson(json);
case ChatActionUploadingDocument.CONSTRUCTOR:
return ChatActionUploadingDocument.fromJson(json);
case ChatActionChoosingSticker.CONSTRUCTOR:
return ChatActionChoosingSticker.fromJson(json);
case ChatActionChoosingLocation.CONSTRUCTOR:
return ChatActionChoosingLocation.fromJson(json);
case ChatActionChoosingContact.CONSTRUCTOR:
return ChatActionChoosingContact.fromJson(json);
case ChatActionStartPlayingGame.CONSTRUCTOR:
return ChatActionStartPlayingGame.fromJson(json);
case ChatActionRecordingVideoNote.CONSTRUCTOR:
return ChatActionRecordingVideoNote.fromJson(json);
case ChatActionUploadingVideoNote.CONSTRUCTOR:
return ChatActionUploadingVideoNote.fromJson(json);
case ChatActionWatchingAnimations.CONSTRUCTOR:
return ChatActionWatchingAnimations.fromJson(json);
case ChatActionCancel.CONSTRUCTOR:
return ChatActionCancel.fromJson(json);
default:
return const ChatAction();
}
}