DiscordGuild.fromJson constructor
DiscordGuild.fromJson(
- Map<String, dynamic> json
)
Implementation
factory DiscordGuild.fromJson(Map<String, dynamic> json) => DiscordGuild(
id: DiscordSnowflake(json[idEntry] as String),
name: json[nameEntry] as String,
icon: json[iconEntry] as String?,
iconHash: json[iconHashEntry] as String?,
splash: json[splashEntry] as String?,
discoverySplash: json[discoverySplashEntry] as String?,
owner: json[ownerEntry] as bool?,
ownerId: DiscordSnowflake(json[ownerIdEntry] as String),
permissions: json[permissionsEntry] as String?,
// ignore: deprecated_member_use_from_same_package
region: json[regionEntry] as String,
afkChannelId: json[afkChannelIdEntry] != null
? DiscordSnowflake(json[afkChannelIdEntry] as String)
: null,
afkTimeout: json[afkTimeoutEntry] as int,
widgetEnabled: json[widgetEnabledEntry] as bool?,
widgetChannelId: json[widgetChannelIdEntry] != null
? DiscordSnowflake(json[widgetChannelIdEntry] as String)
: null,
verificationLevel: json[verificationLevelEntry] as int,
defaultMessageNotifications:
json[defaultMessageNotificationsEntry] as int,
explicitContentFilter: json[explicitContentFilterEntry] as int,
roles: List<DiscordRole>.from(
(json[rolesEntry] as List<Map<String, dynamic>>)
.map(DiscordRole.fromJson),
),
emojis: List<DiscordEmoji>.from(
(json[emojisEntry] as List<Map<String, dynamic>>)
.map(DiscordEmoji.fromJson),
),
features: List<String>.from(json[featuresEntry] as List<String>),
mfaLevel: json[mfaLevelEntry] as int,
applicationId: json[applicationIdEntry] != null
? DiscordSnowflake(json[applicationIdEntry] as String)
: null,
systemChannelId: json[systemChannelIdEntry] != null
? DiscordSnowflake(json[systemChannelIdEntry] as String)
: null,
systemChannelFlags: json[systemChannelFlagsEntry] as int,
rulesChannelId: json[rulesChannelIdEntry] != null
? DiscordSnowflake(json[rulesChannelIdEntry] as String)
: null,
joinedAt: json[joinedAtEntry] as String?,
large: json[largeEntry] as bool?,
unavailable: json[unavailableEntry] as bool?,
memberCount: json[memberCountEntry] as int?,
voiceStates: json[voiceStatesEntry] != null
? List<DiscordVoiceState>.from(
(json[voiceStatesEntry] as List<Map<String, dynamic>>)
.map(DiscordVoiceState.fromJson),
)
: null,
members: json[membersEntry] != null
? List<DiscordGuildMember>.from(
(json[membersEntry] as List<Map<String, dynamic>>)
.map(DiscordGuildMember.fromJson),
)
: null,
channels: json[channelsEntry] != null
? List<DiscordChannel>.from(
(json[channelsEntry] as List<Map<String, dynamic>>)
.map(DiscordChannel.fromJson),
)
: null,
threads: json[presencesEntry] != null
? List<DiscordChannel>.from(
(json[presencesEntry] as List<Map<String, dynamic>>)
.map(DiscordChannel.fromJson),
)
: null,
presences: json[presencesEntry] != null
? List<DiscordPresenceUpdate>.from(
(json[presencesEntry] as List<Map<String, dynamic>>)
.map(DiscordPresenceUpdate.fromJson),
)
: null,
maxPresences: json[maxPresencesEntry] as int?,
maxMembers: json[maxMembersEntry] as int?,
vanityUrlCode: json[vanityUrlCodeEntry] as String?,
description: json[descriptionEntry] as String?,
banner: json[bannerEntry] as String?,
premiumTier: json[premiumTierEntry] as int,
premiumSubscriptionCount: json[premiumSubscriptionCountEntry] as int?,
preferredLocale: json[preferredLocaleEntry] as String,
publicUpdatesChannelId: json[publicUpdatesChannelIdEntry] != null
? DiscordSnowflake(json[publicUpdatesChannelIdEntry] as String)
: null,
maxVideoChannelUsers: json[maxVideoChannelUsersEntry] as int?,
approximateMemberCount: json[approximateMemberCountEntry] as int?,
approximatePresenceCount: json[approximatePresenceCountEntry] as int?,
welcomeScreen: json[welcomeScreenEntry] != null
? DiscordWelcomeScreen.fromJson(
json[welcomeScreenEntry] as Map<String, dynamic>,
)
: null,
nsfwLevel: json[nsfwLevelEntry] as int,
stageInstances: json[stageInstancesEntry] != null
? List<DiscordStageInstance>.from(
(json[stageInstancesEntry] as List<Map<String, dynamic>>)
.map(DiscordStageInstance.fromJson),
)
: null,
stickers: json[stickersEntry] != null
? List<DiscordSticker>.from(
(json[stickersEntry] as List<Map<String, dynamic>>)
.map(DiscordSticker.fromJson),
)
: null,
guildScheduledEvents: json[guildScheduledEventsEntry] != null
? List<DiscordGuildScheduledEvent>.from(
(json[guildScheduledEventsEntry] as List<Map<String, dynamic>>)
.map(DiscordGuildScheduledEvent.fromJson),
)
: null,
premiumProgressBarEnabled: json[premiumProgressBarEnabledEntry] as bool,
);