create static method
Implementation
static User create(Map map) {
User user = User();
user.id = map["id"].toString();
if (user.id.isEmpty) {
user.id = map["sub"].toString();
}
user.phone = map["phone"].toString();
user.email = map["email"].toString();
user.token = map["token"].toString();
if (map.containsKey("mfaToken")) {
user.mfaToken = map["mfaToken"].toString();
}
if (map.containsKey("access_token")) {
user.accessToken = map["access_token"].toString();
}
if (map.containsKey("id_token")) {
user.token = map["id_token"].toString();
}
if (map.containsKey("refresh_token")) {
user.refreshToken = map["refresh_token"].toString();
}
user.username = map["username"].toString();
user.nickname = map["nickname"].toString();
user.company = map["company"].toString();
user.photo = map["photo"].toString();
user.browser = map["browser"].toString();
user.device = map["device"].toString();
user.name = map["name"].toString();
user.givenName = map["givenName"].toString();
user.familyName = map["familyName"].toString();
user.middleName = map["middleName"].toString();
user.profile = map["profile"].toString();
user.preferredUsername = map["preferredUsername"].toString();
user.website = map["website"].toString();
user.gender = map["gender"].toString();
user.birthdate = map["birthdate"].toString();
user.zoneinfo = map["zoneinfo"].toString();
user.locale = map["locale"].toString();
user.address = map["address"].toString();
user.streetAddress = map["streetAddress"].toString();
user.locality = map["locality"].toString();
user.region = map["region"].toString();
user.postalCode = map["postalCode"].toString();
user.city = map["city"].toString();
user.province = map["province"].toString();
if (map.containsKey("token")) {
user.token = map["token"].toString();
}
user.country = map["country"].toString();
return user;
}