NotificationBase.fromJson constructor

NotificationBase.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory NotificationBase.fromJson(Map<String, dynamic> json) {
  switch (json['type']) {
    case 'CubeAnomaly':
      return CubeAnomaly.fromJson(json);
    case 'StateChanged':
      return StateChanged.fromJson(json);
    case 'Escalated':
      return Escalated.fromJson(json);
    case 'Nudge':
      return Nudge.fromJson(json);
    case 'UpcomingEvent':
      return UpcomingEvent.fromJson(json);
    case 'Tagged':
      return Tagged.fromJson(json);
    case 'Invite':
    case 'Complete':
      return Invite.fromJson(json);
    case 'Liked':
      return Liked.fromJson(json);
    case 'Commented':
      return Commented.fromJson(json);
    case 'TextMessage':
      return TextMessage.fromJson(json);
    default:
      throw 'Unexpected notification ${json['type']}';
  }
}