fromJson static method
Returns a new CreateAPISSOUserData instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static CreateAPISSOUserData? 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(() {
assert(json.containsKey(r'email'), 'Required key "CreateAPISSOUserData[email]" is missing from JSON.');
assert(json[r'email'] != null, 'Required key "CreateAPISSOUserData[email]" has a null value in JSON.');
assert(json.containsKey(r'username'), 'Required key "CreateAPISSOUserData[username]" is missing from JSON.');
assert(json[r'username'] != null, 'Required key "CreateAPISSOUserData[username]" has a null value in JSON.');
assert(json.containsKey(r'id'), 'Required key "CreateAPISSOUserData[id]" is missing from JSON.');
assert(json[r'id'] != null, 'Required key "CreateAPISSOUserData[id]" has a null value in JSON.');
return true;
}());
return CreateAPISSOUserData(
groupIds: json[r'groupIds'] is Iterable
? (json[r'groupIds'] as Iterable).cast<String>().toList(growable: false)
: const [],
hasBlockedUsers: mapValueOfType<bool>(json, r'hasBlockedUsers'),
isProfileDMDisabled: mapValueOfType<bool>(json, r'isProfileDMDisabled'),
isProfileCommentsPrivate: mapValueOfType<bool>(json, r'isProfileCommentsPrivate'),
isProfileActivityPrivate: mapValueOfType<bool>(json, r'isProfileActivityPrivate'),
isCommentModeratorAdmin: mapValueOfType<bool>(json, r'isCommentModeratorAdmin'),
isAdminAdmin: mapValueOfType<bool>(json, r'isAdminAdmin'),
isAccountOwner: mapValueOfType<bool>(json, r'isAccountOwner'),
displayName: mapValueOfType<String>(json, r'displayName'),
displayLabel: mapValueOfType<String>(json, r'displayLabel'),
optedInSubscriptionNotifications: mapValueOfType<bool>(json, r'optedInSubscriptionNotifications'),
optedInNotifications: mapValueOfType<bool>(json, r'optedInNotifications'),
avatarSrc: mapValueOfType<String>(json, r'avatarSrc'),
loginCount: mapValueOfType<int>(json, r'loginCount'),
createdFromUrlId: mapValueOfType<String>(json, r'createdFromUrlId'),
signUpDate: mapValueOfType<int>(json, r'signUpDate'),
email: mapValueOfType<String>(json, r'email')!,
websiteUrl: mapValueOfType<String>(json, r'websiteUrl'),
username: mapValueOfType<String>(json, r'username')!,
id: mapValueOfType<String>(json, r'id')!,
);
}
return null;
}