fromJson static method

UpdateInstanceOrganizationSettingsRequest? fromJson(
  1. dynamic value
)

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

Implementation

// ignore: prefer_constructors_over_static_methods
static UpdateInstanceOrganizationSettingsRequest? 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 "UpdateInstanceOrganizationSettingsRequest[$key]" is missing from JSON.');
        assert(json[key] != null,
            'Required key "UpdateInstanceOrganizationSettingsRequest[$key]" has a null value in JSON.');
      });
      return true;
    }());

    return UpdateInstanceOrganizationSettingsRequest(
      enabled: mapValueOfType<bool>(json, r'enabled'),
      maxAllowedMemberships:
          mapValueOfType<int>(json, r'max_allowed_memberships'),
      adminDeleteEnabled: mapValueOfType<bool>(json, r'admin_delete_enabled'),
      domainsEnabled: mapValueOfType<bool>(json, r'domains_enabled'),
      domainsEnrollmentModes: json[r'domains_enrollment_modes'] is Iterable
          ? (json[r'domains_enrollment_modes'] as Iterable)
              .cast<String>()
              .toList(growable: false)
          : const [],
      creatorRoleId: mapValueOfType<String>(json, r'creator_role_id'),
      domainsDefaultRoleId:
          mapValueOfType<String>(json, r'domains_default_role_id'),
    );
  }
  return null;
}