NoticeEvent.fromMap constructor

NoticeEvent.fromMap(
  1. Map map
)

Implementation

factory NoticeEvent.fromMap(Map<dynamic, dynamic> map) {
  NoticeEventType type;
  switch (map['event']) {
    case 'displayed':
      type = NoticeEventType.displayed;
      break;
    case 'notDisplayed':
      type = NoticeEventType.notDisplayed;
      break;
    case 'closed':
      type = NoticeEventType.closed;
      break;
    default:
      type = NoticeEventType.unknown;
  }
  return NoticeEvent(
    source: map['source'] as String? ?? 'notice',
    type: type,
    error: map['error'] as String?,
  );
}