NewsFeedEntry constructor

NewsFeedEntry(
  1. Map<String, String?> entry
)

Implementation

NewsFeedEntry(Map<String, String?> entry) {

  _id = int.parse(_getValueOrDefault(entry, 'id', defaultValue: '-1'));
  _campaignType = DartNewsFeedUtils.convertStringToCampaignType(_getValueOrDefault(entry, 'campaignType'));
  _deviceID = _getValueOrDefault(entry, 'deviceID');
  _title = _getValueOrDefault(entry, 'title');
  _summary = _getValueOrDefault(entry, 'summary');
  _body = _getValueOrDefault(entry, 'body');

  _linkUrl = entry['linkUrl']; // nullable
  _linkUrlString = entry['linkUrlString'];
  _imageUrl = entry['imageUrl']; // nullable
  _imageUrlString = entry['imageUrlString'];

  String? strDeliveredAt = entry['deliveredAt'];
  if (strDeliveredAt != null) {
    _deliveredAt = DateTime.parse(strDeliveredAt); // nullable
  }
  _rawDeliveredAt = entry['deliveredAt']; // nullable

  shown = entry['shown'] == 'true';
  read = entry['read'] == 'true';
}