fromJson static method
Implementation
static Guild fromJson(Map<String, dynamic> json) {
var features = json['features'];
return Guild(
id: json['id'],
name: json['name'],
icon: json['icon'],
iconHash: json['icon_hash'],
splash: json['splash'],
discoverySplash: json['discovery_splash'],
owner: json['owner'],
ownerId: json['owner_id'],
permissions: json['permissions'],
region: json['region'],
afkChannelId: json['afk_channel_id'],
afkTimeout: json['afk_timeout'],
widgetEnabled: json['widget_enabled'],
verificationLevel: json['verification_level'],
defaultMessageNotifications: json['default_message_notifications'],
explicitContentFilter: json['explicit_content_filter'],
roles: fromArray(Role.fromJson, json['roles'])!,
emojis: fromArray(Emoji.fromJson, json['emojis'])!,
features: List.generate(
features.length,
(i) => GuildFeature.forValue(features[i]),
),
mfaLevel: json['mfa_level'],
applicationId: json['application_id'],
systemChannelId: json['system_channel_id'],
systemChannelFlags: json['system_channel_flags'],
rulesChannelId: json['rules_channel_id'],
joinedAt: json['joined_at'],
large: json['large'],
unavailable: json['unavailable'],
memberCount: json['member_count'],
voiceStates: fromArray(VoiceState.fromJson, json['voice_states']),
members: fromArray(Member.fromJson, json['members']),
channels: fromArray(Channel.fromJson, json['channels']),
presences: fromArray(PresenceUpdate.fromJson, json['presences']),
maxPresences: json['max_presences'],
maxMembers: json['max_members'],
vanityUrlCode: json['vanity_url_code'],
description: json['description'],
banner: json['banner'],
premiumTier: json['premium_tier'],
premiumSubscriptionCount: json['premium_subscription_count'],
preferredLocale: json['preferred_locale'],
publicUpdatesChannelId: json['public_updates_channel_id'],
maxVideoChannelUsers: json['max_video_channel_users'],
approximateMemberCount: json['approximate_member_count'],
approximatePresenceCount: json['approximate_presence_count'],
welcomeScreen: ifNotNull(WelcomeScreen.fromJson, json['welcome_screen']),
);
}