fromJson static method

GetUserInternalProfileResponseProfile? fromJson(
  1. dynamic value
)

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

Implementation

// ignore: prefer_constructors_over_static_methods
static GetUserInternalProfileResponseProfile? 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 GetUserInternalProfileResponseProfile(
      commenterName: mapValueOfType<String>(json, r'commenterName'),
      firstCommentDate: mapDateTime(json, r'firstCommentDate', r''),
      ipHash: mapValueOfType<String>(json, r'ipHash'),
      countryFlag: mapValueOfType<String>(json, r'countryFlag'),
      countryCode: mapValueOfType<String>(json, r'countryCode'),
      websiteUrl: mapValueOfType<String>(json, r'websiteUrl'),
      bio: mapValueOfType<String>(json, r'bio'),
      karma: mapValueOfType<double>(json, r'karma'),
      locale: mapValueOfType<String>(json, r'locale'),
      verified: mapValueOfType<bool>(json, r'verified'),
      avatarSrc: mapValueOfType<String>(json, r'avatarSrc'),
      displayName: mapValueOfType<String>(json, r'displayName'),
      username: mapValueOfType<String>(json, r'username'),
      commenterEmail: mapValueOfType<String>(json, r'commenterEmail'),
      email: mapValueOfType<String>(json, r'email'),
      anonUserId: mapValueOfType<String>(json, r'anonUserId'),
      userId: mapValueOfType<String>(json, r'userId'),
    );
  }
  return null;
}