fromJson static method

MmEnvironmentConfigServiceSettings? fromJson(
  1. dynamic value
)

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

Implementation

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

    return MmEnvironmentConfigServiceSettings(
      siteURL: mapValueOfType<bool>(json, r'SiteURL'),
      listenAddress: mapValueOfType<bool>(json, r'ListenAddress'),
      connectionSecurity: mapValueOfType<bool>(json, r'ConnectionSecurity'),
      tLSCertFile: mapValueOfType<bool>(json, r'TLSCertFile'),
      tLSKeyFile: mapValueOfType<bool>(json, r'TLSKeyFile'),
      useLetsEncrypt: mapValueOfType<bool>(json, r'UseLetsEncrypt'),
      letsEncryptCertificateCacheFile: mapValueOfType<bool>(json, r'LetsEncryptCertificateCacheFile'),
      forward80To443: mapValueOfType<bool>(json, r'Forward80To443'),
      readTimeout: mapValueOfType<bool>(json, r'ReadTimeout'),
      writeTimeout: mapValueOfType<bool>(json, r'WriteTimeout'),
      maximumLoginAttempts: mapValueOfType<bool>(json, r'MaximumLoginAttempts'),
      segmentDeveloperKey: mapValueOfType<bool>(json, r'SegmentDeveloperKey'),
      googleDeveloperKey: mapValueOfType<bool>(json, r'GoogleDeveloperKey'),
      enableOAuthServiceProvider: mapValueOfType<bool>(json, r'EnableOAuthServiceProvider'),
      enableIncomingWebhooks: mapValueOfType<bool>(json, r'EnableIncomingWebhooks'),
      enableOutgoingWebhooks: mapValueOfType<bool>(json, r'EnableOutgoingWebhooks'),
      enableCommands: mapValueOfType<bool>(json, r'EnableCommands'),
      enableOnlyAdminIntegrations: mapValueOfType<bool>(json, r'EnableOnlyAdminIntegrations'),
      enablePostUsernameOverride: mapValueOfType<bool>(json, r'EnablePostUsernameOverride'),
      enablePostIconOverride: mapValueOfType<bool>(json, r'EnablePostIconOverride'),
      enableTesting: mapValueOfType<bool>(json, r'EnableTesting'),
      enableDeveloper: mapValueOfType<bool>(json, r'EnableDeveloper'),
      enableSecurityFixAlert: mapValueOfType<bool>(json, r'EnableSecurityFixAlert'),
      enableInsecureOutgoingConnections: mapValueOfType<bool>(json, r'EnableInsecureOutgoingConnections'),
      enableMultifactorAuthentication: mapValueOfType<bool>(json, r'EnableMultifactorAuthentication'),
      enforceMultifactorAuthentication: mapValueOfType<bool>(json, r'EnforceMultifactorAuthentication'),
      allowCorsFrom: mapValueOfType<bool>(json, r'AllowCorsFrom'),
      sessionLengthWebInDays: mapValueOfType<bool>(json, r'SessionLengthWebInDays'),
      sessionLengthMobileInDays: mapValueOfType<bool>(json, r'SessionLengthMobileInDays'),
      sessionLengthSSOInDays: mapValueOfType<bool>(json, r'SessionLengthSSOInDays'),
      sessionCacheInMinutes: mapValueOfType<bool>(json, r'SessionCacheInMinutes'),
      websocketSecurePort: mapValueOfType<bool>(json, r'WebsocketSecurePort'),
      websocketPort: mapValueOfType<bool>(json, r'WebsocketPort'),
      webserverMode: mapValueOfType<bool>(json, r'WebserverMode'),
      enableCustomEmoji: mapValueOfType<bool>(json, r'EnableCustomEmoji'),
      restrictCustomEmojiCreation: mapValueOfType<bool>(json, r'RestrictCustomEmojiCreation'),
    );
  }
  return null;
}