fromJson static method
Returns a new MmConfig instance and imports its values from
value
if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static MmConfig? 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 "MmConfig[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "MmConfig[$key]" has a null value in JSON.');
});
return true;
}());
return MmConfig(
serviceSettings: MmConfigServiceSettings.fromJson(json[r'ServiceSettings']),
teamSettings: MmConfigTeamSettings.fromJson(json[r'TeamSettings']),
sqlSettings: MmConfigSqlSettings.fromJson(json[r'SqlSettings']),
logSettings: MmConfigLogSettings.fromJson(json[r'LogSettings']),
passwordSettings: MmConfigPasswordSettings.fromJson(json[r'PasswordSettings']),
fileSettings: MmConfigFileSettings.fromJson(json[r'FileSettings']),
emailSettings: MmConfigEmailSettings.fromJson(json[r'EmailSettings']),
rateLimitSettings: MmConfigRateLimitSettings.fromJson(json[r'RateLimitSettings']),
privacySettings: MmConfigPrivacySettings.fromJson(json[r'PrivacySettings']),
supportSettings: MmConfigSupportSettings.fromJson(json[r'SupportSettings']),
gitLabSettings: MmConfigGitLabSettings.fromJson(json[r'GitLabSettings']),
googleSettings: MmConfigGitLabSettings.fromJson(json[r'GoogleSettings']),
office365Settings: MmConfigGitLabSettings.fromJson(json[r'Office365Settings']),
ldapSettings: MmConfigLdapSettings.fromJson(json[r'LdapSettings']),
complianceSettings: MmConfigComplianceSettings.fromJson(json[r'ComplianceSettings']),
localizationSettings: MmConfigLocalizationSettings.fromJson(json[r'LocalizationSettings']),
samlSettings: MmConfigSamlSettings.fromJson(json[r'SamlSettings']),
nativeAppSettings: MmConfigNativeAppSettings.fromJson(json[r'NativeAppSettings']),
clusterSettings: MmConfigClusterSettings.fromJson(json[r'ClusterSettings']),
metricsSettings: MmConfigMetricsSettings.fromJson(json[r'MetricsSettings']),
analyticsSettings: MmConfigAnalyticsSettings.fromJson(json[r'AnalyticsSettings']),
);
}
return null;
}