fromJson static method
Returns a new MmEnvironmentConfig instance and imports its values from
value
if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static MmEnvironmentConfig? 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 "MmEnvironmentConfig[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "MmEnvironmentConfig[$key]" has a null value in JSON.');
});
return true;
}());
return MmEnvironmentConfig(
serviceSettings: MmEnvironmentConfigServiceSettings.fromJson(json[r'ServiceSettings']),
teamSettings: MmEnvironmentConfigTeamSettings.fromJson(json[r'TeamSettings']),
sqlSettings: MmEnvironmentConfigSqlSettings.fromJson(json[r'SqlSettings']),
logSettings: MmEnvironmentConfigLogSettings.fromJson(json[r'LogSettings']),
passwordSettings: MmEnvironmentConfigPasswordSettings.fromJson(json[r'PasswordSettings']),
fileSettings: MmEnvironmentConfigFileSettings.fromJson(json[r'FileSettings']),
emailSettings: MmEnvironmentConfigEmailSettings.fromJson(json[r'EmailSettings']),
rateLimitSettings: MmEnvironmentConfigRateLimitSettings.fromJson(json[r'RateLimitSettings']),
privacySettings: MmConfigPrivacySettings.fromJson(json[r'PrivacySettings']),
supportSettings: MmEnvironmentConfigSupportSettings.fromJson(json[r'SupportSettings']),
gitLabSettings: MmEnvironmentConfigGitLabSettings.fromJson(json[r'GitLabSettings']),
googleSettings: MmEnvironmentConfigGitLabSettings.fromJson(json[r'GoogleSettings']),
office365Settings: MmEnvironmentConfigGitLabSettings.fromJson(json[r'Office365Settings']),
ldapSettings: MmEnvironmentConfigLdapSettings.fromJson(json[r'LdapSettings']),
complianceSettings: MmEnvironmentConfigComplianceSettings.fromJson(json[r'ComplianceSettings']),
localizationSettings: MmEnvironmentConfigLocalizationSettings.fromJson(json[r'LocalizationSettings']),
samlSettings: MmEnvironmentConfigSamlSettings.fromJson(json[r'SamlSettings']),
nativeAppSettings: MmEnvironmentConfigNativeAppSettings.fromJson(json[r'NativeAppSettings']),
clusterSettings: MmEnvironmentConfigClusterSettings.fromJson(json[r'ClusterSettings']),
metricsSettings: MmEnvironmentConfigMetricsSettings.fromJson(json[r'MetricsSettings']),
analyticsSettings: MmEnvironmentConfigAnalyticsSettings.fromJson(json[r'AnalyticsSettings']),
);
}
return null;
}