Shard class Null safety

Shard is single connection to discord gateway. Since bots can grow big, handling thousand of guild on same websocket connections would be very hand. Traffic can be split into different connections which can be run on different processes or even different machines.

Implemented types


connected bool
Returns true if shard is connected to websocket
gatewayLatency Duration
Gets the latest gateway latency. [...]
guilds List<Snowflake>
List of handled guild ids
hashCode int
The hash code for this object. [...]
read-only, inherited
id int
Id of shard
manager ShardManager
Reference to ShardManager
onDisconnect Stream<Shard>
Emitted when the shard encounters a connection error
late, final
onMemberChunk Stream<MemberChunkEvent>
Emitted when shard receives member chunk.
late, final
onResume Stream<Shard>
Emitted when the shard resumed its connection
late, final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


changeVoiceState(Snowflake? guildId, Snowflake? channelId, {bool selfMute = false, bool selfDeafen = false}) → void
Updates clients voice state for Guild with given guildId
dispose() Future<void>
Perform cleanup
guildSync() → void
Syncs all guilds
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
requestMembers(dynamic guild, {String? query, Iterable<Snowflake>? userIds, int limit = 0, bool presences = false, String? nonce}) → void
Allows to request members objects from gateway guild can be either Snowflake or Iterable
send(int opCode, dynamic d) → void
Sends WS data.
setPresence(PresenceBuilder presenceBuilder) → void
Allows to set presence for current shard.
toString() String
A string representation of this object. [...]


operator ==(Object other) bool
The equality operator. [...]