UserModel.fromJson constructor

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

to convert json data into user object

Implementation

factory UserModel.fromJson(Map<String, dynamic> json) => UserModel(
      userName: json["username"] ?? "",
      email: json["email"] ?? "",
      firstName: json["first_name"] ?? "",
      lastName: json["last_name"] ?? "",
      isActive: json["is_active"] ?? false,
      type: json["type"] ?? "",
      phone: json["phone"] ?? "",
      business: json["business"] ?? 0,
      photo: json["photo"] ?? "",
      franchise: json["franchise"] ?? 0,
      approved: json["approved"] ?? false,
      isTester: json["is_tester"] ?? false,
      coin: json["coin"] ?? "",
      telegramUserName: json["telegram_username"] ?? "",
      referralCode: json["referral_code"],
      referBy: json["refer_by"],
      socialProfiles: json["social_profiles"] ?? [],
      setting: UserSetting.fromJson(json["setting"]),
      token: json["token"] ?? "",
      id: json["id"] ?? 0,
    );