fromJson static method

MmEnvironmentConfigLdapSettings? fromJson(
  1. dynamic value
)

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

Implementation

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

    return MmEnvironmentConfigLdapSettings(
      enable: mapValueOfType<bool>(json, r'Enable'),
      ldapServer: mapValueOfType<bool>(json, r'LdapServer'),
      ldapPort: mapValueOfType<bool>(json, r'LdapPort'),
      connectionSecurity: mapValueOfType<bool>(json, r'ConnectionSecurity'),
      baseDN: mapValueOfType<bool>(json, r'BaseDN'),
      bindUsername: mapValueOfType<bool>(json, r'BindUsername'),
      bindPassword: mapValueOfType<bool>(json, r'BindPassword'),
      userFilter: mapValueOfType<bool>(json, r'UserFilter'),
      firstNameAttribute: mapValueOfType<bool>(json, r'FirstNameAttribute'),
      lastNameAttribute: mapValueOfType<bool>(json, r'LastNameAttribute'),
      emailAttribute: mapValueOfType<bool>(json, r'EmailAttribute'),
      usernameAttribute: mapValueOfType<bool>(json, r'UsernameAttribute'),
      nicknameAttribute: mapValueOfType<bool>(json, r'NicknameAttribute'),
      idAttribute: mapValueOfType<bool>(json, r'IdAttribute'),
      positionAttribute: mapValueOfType<bool>(json, r'PositionAttribute'),
      syncIntervalMinutes: mapValueOfType<bool>(json, r'SyncIntervalMinutes'),
      skipCertificateVerification: mapValueOfType<bool>(json, r'SkipCertificateVerification'),
      queryTimeout: mapValueOfType<bool>(json, r'QueryTimeout'),
      maxPageSize: mapValueOfType<bool>(json, r'MaxPageSize'),
      loginFieldName: mapValueOfType<bool>(json, r'LoginFieldName'),
    );
  }
  return null;
}