fromJson static method
Returns a new UserGetResponse instance and imports its values from
value
if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static UserGetResponse? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "UserGetResponse[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "UserGetResponse[$key]" has a null value in JSON.');
});
return true;
}());
return UserGetResponse(
id: mapValueOfType<String>(json, r'Id'),
name: mapValueOfType<String>(json, r'Name'),
userName: mapValueOfType<String>(json, r'UserName'),
editable: mapValueOfType<bool>(json, r'Editable'),
phoneNumber: mapValueOfType<String>(json, r'PhoneNumber'),
email: mapValueOfType<String>(json, r'Email'),
emailFinancial: mapValueOfType<String>(json, r'EmailFinancial'),
imageFile: mapValueOfType<String>(json, r'ImageFile'),
objectAddress: mapValueOfType<String>(json, r'ObjectAddress'),
objectTitle: mapValueOfType<String>(json, r'ObjectTitle'),
companyName: mapValueOfType<String>(json, r'CompanyName'),
contractNumber: mapValueOfType<String>(json, r'ContractNumber'),
bankName: mapValueOfType<String>(json, r'BankName'),
bankBik: mapValueOfType<String>(json, r'BankBik'),
bankCorrAccount: mapValueOfType<String>(json, r'BankCorrAccount'),
bankPayAccount: mapValueOfType<String>(json, r'BankPayAccount'),
signerFio: mapValueOfType<String>(json, r'SignerFio'),
signerJob: mapValueOfType<String>(json, r'SignerJob'),
signerDoc: mapValueOfType<String>(json, r'SignerDoc'),
financeFIO: mapValueOfType<String>(json, r'FinanceFIO'),
financeEmail: mapValueOfType<String>(json, r'FinanceEmail'),
financePhone: mapValueOfType<String>(json, r'FinancePhone'),
edo: mapValueOfType<bool>(json, r'Edo'),
techFIO: mapValueOfType<String>(json, r'TechFIO'),
techEmail: mapValueOfType<String>(json, r'TechEmail'),
techPhone: mapValueOfType<String>(json, r'TechPhone'),
locked: mapValueOfType<bool>(json, r'Locked'),
registrationDate: mapDateTime(json, r'RegistrationDate', ''),
accessDate: mapDateTime(json, r'AccessDate', ''),
contractDate: mapDateTime(json, r'ContractDate', ''),
role: Role.fromJson(json[r'Role']),
legalFormShort: mapValueOfType<String>(json, r'LegalFormShort'),
legalFormFull: mapValueOfType<String>(json, r'LegalFormFull'),
addressLegal: mapValueOfType<String>(json, r'AddressLegal'),
addressPostal: mapValueOfType<String>(json, r'AddressPostal'),
addressActual: mapValueOfType<String>(json, r'AddressActual'),
inn: mapValueOfType<String>(json, r'Inn'),
kpp: mapValueOfType<String>(json, r'Kpp'),
ogrn: mapValueOfType<String>(json, r'Ogrn'),
companyTypeUsers: PlaylistGetCompany.listFromJson(json[r'CompanyTypeUsers']) ?? const [],
playlists: UserGetPlaylist.listFromJson(json[r'Playlists']) ?? const [],
feeds: UserGetFeed.listFromJson(json[r'Feeds']) ?? const [],
tickets: UserGetTicket.listFromJson(json[r'Tickets']) ?? const [],
places: UserGetPlace.listFromJson(json[r'Places']) ?? const [],
);
}
return null;
}