ContestDataModel.fromJson constructor

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

Implementation

ContestDataModel.fromJson(Map<String, dynamic> json) {
  sId = json['_id'];
  image = json['image'];
  clientId = json['client_id'];
  name = json['name'];
  description = json['description'];
  startDate = json['start_date'];
  endDate = json['end_date'];
  createdAt = json['created_at'];
  updatedAt = json['updated_at'];
  if (json['challenges'] != null) {
    challenges = <Challenges>[];
    json['challenges'].forEach((v) {
      challenges!.add(Challenges.fromJson(v));
    });
  }
  if (json['rewards'] != null) {
    rewards = <Rewards>[];
    json['rewards'].forEach((v) {
      rewards!.add(Rewards.fromJson(v));
    });
  }
  iV = json['__v'];
}