fromJson static method
Returns a new MmConfigTeamSettings instance and imports its values from
value
if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static MmConfigTeamSettings? 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 "MmConfigTeamSettings[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "MmConfigTeamSettings[$key]" has a null value in JSON.');
});
return true;
}());
return MmConfigTeamSettings(
siteName: mapValueOfType<String>(json, r'SiteName'),
maxUsersPerTeam: mapValueOfType<int>(json, r'MaxUsersPerTeam'),
enableTeamCreation: mapValueOfType<bool>(json, r'EnableTeamCreation'),
enableUserCreation: mapValueOfType<bool>(json, r'EnableUserCreation'),
enableOpenServer: mapValueOfType<bool>(json, r'EnableOpenServer'),
restrictCreationToDomains: mapValueOfType<String>(json, r'RestrictCreationToDomains'),
enableCustomBrand: mapValueOfType<bool>(json, r'EnableCustomBrand'),
customBrandText: mapValueOfType<String>(json, r'CustomBrandText'),
customDescriptionText: mapValueOfType<String>(json, r'CustomDescriptionText'),
restrictDirectMessage: mapValueOfType<String>(json, r'RestrictDirectMessage'),
restrictTeamInvite: mapValueOfType<String>(json, r'RestrictTeamInvite'),
restrictPublicChannelManagement: mapValueOfType<String>(json, r'RestrictPublicChannelManagement'),
restrictPrivateChannelManagement: mapValueOfType<String>(json, r'RestrictPrivateChannelManagement'),
restrictPublicChannelCreation: mapValueOfType<String>(json, r'RestrictPublicChannelCreation'),
restrictPrivateChannelCreation: mapValueOfType<String>(json, r'RestrictPrivateChannelCreation'),
restrictPublicChannelDeletion: mapValueOfType<String>(json, r'RestrictPublicChannelDeletion'),
restrictPrivateChannelDeletion: mapValueOfType<String>(json, r'RestrictPrivateChannelDeletion'),
userStatusAwayTimeout: mapValueOfType<int>(json, r'UserStatusAwayTimeout'),
maxChannelsPerTeam: mapValueOfType<int>(json, r'MaxChannelsPerTeam'),
maxNotificationsPerChannel: mapValueOfType<int>(json, r'MaxNotificationsPerChannel'),
);
}
return null;
}