messageFromJson function

InboxMessage? messageFromJson(
  1. Map<String, dynamic> message
)

Implementation

InboxMessage? messageFromJson(Map<String, dynamic> message) {
  try {
    return InboxMessage(
        message.containsKey(ID) ? message[ID] : -1,
        message[CAMPAIGN_ID],
        textContentFromMap(message[TEXT_CONTENT]),
        message[IS_CLICKED],
        message.containsKey(MEDIA_CONTENT)
            ? mediaFromMap(message[MEDIA_CONTENT])
            : null,
        actionsFromMap(message[ACTION]),
        message.containsKey(TAG) ? message[TAG] : "general",
        message[RECEIVED_TIME],
        message[EXPIRY_TIME],
        message[PAYLOAD]);
  } catch (e) {
    print(e);
  }
  return null;
}