fromJson method

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

Implementation

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

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