fromJson method

  1. @override
UGetMessagesMessage fromJson(
  1. Map<String, dynamic> json
)

Implementation

@override
UGetMessagesMessage fromJson(Map<String, dynamic> json) {
  try {
    if (isMessageView(json)) {
      return UGetMessagesMessage.messageView(
        data: const MessageViewConverter().fromJson(json),
      );
    }
    if (isDeletedMessageView(json)) {
      return UGetMessagesMessage.deletedMessageView(
        data: const DeletedMessageViewConverter().fromJson(json),
      );
    }

    return UGetMessagesMessage.unknown(data: json);
  } catch (_) {
    return UGetMessagesMessage.unknown(data: json);
  }
}