fromJson static method

PeamanMessage fromJson(
  1. Map<String, dynamic> data
)

Implementation

static PeamanMessage fromJson(Map<String, dynamic> data) {
  return PeamanMessage(
    id: data['id'],
    chatId: data['chat_id'],
    text: data['text'],
    files: List<PeamanFileUrl>.from(
      (data['files'] ?? []).map((e) => PeamanFileUrl.fromJson(e)).toList(),
    ),
    senderId: data['sender_id'],
    type: PeamanMessageType.values[data['type'] ?? 0],
    receiverIds: List<String>.from(data['receiver_ids'] ?? []),
    extraId: data['extra_id'],
    createdAt: data['created_at'],
    updatedAt: data['updated_at'],
    visibility: data['visibility'] ?? true,
    extraData: data,
  );
}