UserAdModel.fromJson constructor

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

model user ad return model inf

@odata.context
id
displayName
givenName
surname
userPrincipalName
mail
businessPhones
jobTitle
mobilePhone
officeLocation
preferredLanguage
accessToken -> token user
expiresOn -> date time of expiration

Implementation

factory UserAdModel.fromJson(Map<String, dynamic> json) {
  return UserAdModel(
    odataContext: json['@odata.context'],
    id: json['id'],
    displayName: json['displayName'],
    givenName: json['givenName'],
    surname: json['surname'],
    userPrincipalName: (json["userPrincipalName"] != null)
        ? json['userPrincipalName'].toString().toLowerCase()
        : 'N/D',
    mail:
        (json['mail'] != null) ? json['mail'].toString().toLowerCase() : null,
    accessToken: json['accessToken'],
    expiresOn: json["expiresOn"],
    businessPhones: (json["businessPhones"] != null)
        ? json["businessPhones"].cast<String>()
        : null,
    jobTitle: json['jobTitle'],
    mobilePhone: json['mobilePhone'],
    officeLocation: json['officeLocation'],
    preferredLanguage: json['preferredLanguage'],
  );
}