NotificationDTO.fromJson constructor

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

Implementation

NotificationDTO.fromJson(Map<String, dynamic> json) {
  super.id = json['id'];
  super.createdAt = json['createdAt'];
  super.updatedAt = json['updatedAt'];
  super.isActive = json['isActive'];
  super.isDeleted = json['isDeleted'];
  title = json['title'];
  description = json['description'];
  photoUrl = json['photoUrl'];
  oneSignalId = json['oneSignalId'];
  user = json['user'] != null ? ProfileDTO.fromJson(json['user']) : null;
  if (json['products'] != null) {
    products = <ProductDTO>[];
    json['products'].forEach((v) {
      products!.add(ProductDTO.fromJson(v));
    });
  }
  if (json['categories'] != null) {
    categories = <CategoryDTO>[];
    json['categories'].forEach((v) {
      categories!.add(CategoryDTO.fromJson(v));
    });
  }
  if (json['campaigns'] != null) {
    campaigns = <CampaignDTO>[];
    json['campaigns'].forEach((v) {
      campaigns!.add(CampaignDTO.fromJson(v));
    });
  }
}