UserModel.fromJson constructor

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

Implementation

factory UserModel.fromJson(Map<String, dynamic> json) {
  return UserModel(
    id: json['id'],
    emailAddress: json['emailAddress'],
    phoneNumber: json['phoneNumber'],
    password: json['password'],
    fullName: json['fullName'],
    createdAt: DateTime.parse(json['createdAt']),
    updatedAt: json['updatedAt'] != null
        ? DateTime.parse(json['updatedAt'])
        : null,
    isAdmin: json['isAdmin'] ?? false,
    newUser: json['newUser'] ?? true,
    xoraiaID: json['xoraiaID'],
    apiKey: json['apiKey'],
    token: json['token'],
    tokenExpirationDate: json['tokenExpirationDate'] != null
        ? DateTime.parse(json['tokenExpirationDate'])
        : null,
    companyTypeId: json['companyTypeId'],
    logo: json['logo'],
    description: json['description'],
    address: json['address'],
    city: json['city'],
    country:
        json['country'] != null ? Country.fromValue(json['country']) : null,
    availableCredit: json['availableCredit'] ?? 0,
    blocked: json['blocked'] ?? false,
    isVerified: json['isVerified'] ?? false,
    codePromo: json['codePromo'],
  );
}