fromJson static method

UpdateAPISSOUserData? fromJson(
  1. dynamic value
)

Returns a new UpdateAPISSOUserData instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static UpdateAPISSOUserData? 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(() {
      return true;
    }());

    return UpdateAPISSOUserData(
      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;
}