Data.fromJson constructor

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

Implementation

factory Data.fromJson(Map<String, dynamic> json) {
  return Data(
    id: json["_id"],
    deviceId: json["deviceId"],
    name: json["name"],
    email: json["email"],
    phoneNumber: json["phoneNumber"],
    referredBy: json["referredBy"],
    referrerCode: json["referrerCode"],
    usersReferred: json["usersReferred"],
    referralCode: json["referralCode"],
    referralCodeExpiry: json["referralCodeExpiry"],
    externalId: json["externalId"],
    score: json["score"],
    clientId: json["clientId"],
    shareId: json["shareId"],
    token: json["token"],
    tags: json["tags"] == null
        ? []
        : List<dynamic>.from(json["tags"]!.map((x) => x)),
    tasks: json["tasks"] == null
        ? []
        : List<dynamic>.from(json["tasks"]!.map((x) => x)),
    rewards: json["rewards"] == null
        ? []
        : List<Reward>.from(json["rewards"]!.map((x) => Reward.fromJson(x))),
    photoUrl: json["photoUrl"],
    createdAt: DateTime.tryParse(json["createdAt"] ?? ""),
    updatedAt: DateTime.tryParse(json["updatedAt"] ?? ""),
    v: json["__v"],
    properties: json["properties"] == null
        ? null
        : DataProperties.fromJson(json["properties"]),
  );
}