GroupChannel class

Represents group channel

In most case, any static or instance method will throw a SBError if anything goes wrong such as parameter is not provided or connection has not been maded. Use method with try/catch block or then/catchError callback

try {
   final channel = GroupChannel.getChannel('1234');
   //do something with channel
} catch (e) {
   //handle error
}

or

GroupChannel.getChannel('1234').then((channel) {
  //do seomthing with channel
}).catchError((e) {
  //handle error
})
Inheritance
Available extensions
Annotations
  • @JsonSerializable()

Constructors

GroupChannel({BaseMessage? lastMessage, bool isSuper = false, bool isStrict = false, bool isBroadcast = false, bool isPublic = false, bool isDistinct = false, bool isDiscoverable = false, bool isExclusive = false, bool accessCodeRequired = false, int unreadMessageCount = 0, int unreadMentionCount = 0, List<Member> members = const [], int memberCount = 0, int joinedMemberCount = 0, int joinedAt = 0, GroupChannelPushTriggerOption myPushTriggerOption = GroupChannelPushTriggerOption.all, MemberState myMemberState = MemberState.none, Role myRole = Role.none, MuteState myMutedState = MuteState.unmuted, CountPreference myCountPreference = CountPreference.all, int invitedAt = 0, Member? inviter, bool isHidden = false, GroupChannelHiddenState hiddenState = GroupChannelHiddenState.unhidden, int myLastRead = 0, int? messageOffsetTimestamp, int messageSurvivalSeconds = -1, required String channelUrl, String? name, String? coverUrl, User? creator, int? createdAt, String? data, String? customType, bool isFrozen = false, bool isEphemeral = false, BaseMessage? lastPinnedMessage, int pinnedMessagesUpdatedAt = 0})
WARNING: Do not use default constructor to initialize manually
GroupChannel.fromJson(Map<String, dynamic> json)
factory
GroupChannel.fromJsonAndCached(Map<String, dynamic> json, {int? ts})
factory

Properties

accessCodeRequired bool
True if this channel is required access code
getter/setter pair
canChangeUnreadMentionCount bool

Available on GroupChannel, provided by the GroupChannelInternal extension

no setter
canChangeUnreadMessageCount bool

Available on GroupChannel, provided by the GroupChannelInternal extension

no setter
channelType ChannelType
Channel type for this channel
no setterinherited
channelUrl String
This channel url
getter/setter pairinherited
coverUrl String?
cover image URL for this channel
getter/setter pairinherited
createdAt int?
timestamp when this channel is created
getter/setter pairinherited
creator User?
User who creates this channel
getter/setter pairinherited
customType String?
custom type for this channel
getter/setter pairinherited
data String?
custom data for this channel
getter/setter pairinherited
dirty bool
getter/setter pairinherited
fromCache bool
local usage
getter/setter pairinherited
hashCode int
The hash code for this object.
no setteroverride
hiddenState GroupChannelHiddenState
Hidden state of this channel
getter/setter pair
invitedAt int
Timestamp when current user got a invitation from other user in the channel
getter/setter pair
inviter Member?
User who invited
getter/setter pair
isBroadcast bool
True if this channel is broadcast
getter/setter pair
isDiscoverable bool
True if this channel is discoverable It is only for a public group channel.
getter/setter pair
isDistinct bool
True if this channel is distinct
getter/setter pair
isEphemeral bool
True if this channel is ephemeral
getter/setter pairinherited
isExclusive bool
True if this channel is exclusive
getter/setter pair
isFrozen bool
Ture if this channel is frozen
getter/setter pairinherited
isHidden bool
True if this channel is hidden
getter/setter pair
isPublic bool
True if this channel is public
getter/setter pair
isStrict bool
True if this channel is strict
final
isSuper bool
True if this channel is super channel
getter/setter pair
isTyping bool

Available on GroupChannel, provided by the GroupChannelTyping extension

Returns true if any members has been typing.
no setter
joinedAt int
Timestamp when current user joined on this channel
getter/setter pair
joinedMemberCount int
Number of joined member
getter/setter pair
key String
no setterinherited
lastMessage BaseMessage?
Last message of the channel
getter/setter pair
lastPinnedMessage BaseMessage?
Last Pinned Message
getter/setter pair
memberCount int
Number of members
getter/setter pair
members List<Member>
Channel members Note: Number of member for SuperGroupChannel is limited to 10
getter/setter pair
messageOffsetTimestamp int?
Message offset of this channel. User can only see messages after this offset
getter/setter pair
messageSurvivalSeconds int
A value that sets the message survival time in seconds. In the channel that is created or updated with this option, the read messages are automatically deleted after a determined amount of time. The default value is -1 that represents the disappearing message is disabled. Note: This feature is available in a 1-on-1 group channel.
getter/setter pair
myCountPreference CountPreference
Message count preference of current user in this channel The default value is all
getter/setter pair
myLastRead int
A last read information for the current user
getter/setter pair
myMemberState MemberState
Member state of current user in this channel
getter/setter pair
myMutedState MuteState
Muted state of current user in this channel
getter/setter pair
myPushTriggerOption GroupChannelPushTriggerOption
Push notification option for the current user to receive in the group channel
getter/setter pair
myRole Role
Role of current user in this channel
getter/setter pair
name String?
name for this channel
getter/setter pairinherited
pinnedMessageIds List<int>?
List of Pinned Message Ids
getter/setter pair
pinnedMessagesUpdatedAt int
Time updated at Pinned Message
getter/setter pair
primaryKey String
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
unreadMentionCount int
The number of mentions that user does not read yet in the channel
getter/setter pair
unreadMessageCount int
Unread message count of the channel
getter/setter pair

Methods

acceptInvitation({String? accessCode}) Future<void>

Available on GroupChannel, provided by the GroupChannelOperations extension

Accepts received invitation to join on this channel.
addMember(Member? newMember) → void

Available on GroupChannel, provided by the GroupChannelInternal extension

addMessageMetaArray(BaseMessage message, List<MessageMetaArray> metaArrays) Future<BaseMessage>

Available on BaseChannel, provided by the Meta extension

Adds list of metaArrays with given message.
addOperators(List<String> userIds) Future<void>

Available on BaseChannel, provided by the BaseChannelConfiguration extension

Adds operators on this channel with given userIds.
addPollOption({required int pollId, required String optionText, OnPollCallback? onCompleted}) Future<Poll>

Available on BaseChannel, provided by the Messages extension

Add Poll Option
addReaction(BaseMessage message, String key) Future<ReactionEvent>

Available on BaseChannel, provided by the Reactions extension

Adds reaction key to given message
banUser({required String userId, int seconds = -1, String? description}) Future<void>

Available on BaseChannel, provided by the Moderations extension

Bans a user from this channel.
cancelScheduledMessage(int scheduledMessageId, {OnScheduledMessageCancelCallback? callback}) Future<void>

Available on BaseChannel, provided by the Messages extension

Cancels scheduled message
cancelUploadingFileMessage(String requestId) bool

Available on BaseChannel, provided by the Messages extension

clearUnreadCount() → void

Available on GroupChannel, provided by the GroupChannelInternal extension

closePoll({required int pollId, OnPollCallback? onCompleted}) Future<Poll>

Available on BaseChannel, provided by the Messages extension

Close Poll
copyMessage(BaseMessage message, BaseChannel targetChannel, {OnMessageCallback? onCompleted}) BaseMessage

Available on BaseChannel, provided by the Messages extension

Copies message to targetChannel.
copyWith(dynamic other) → void
override
createMetaCounters(Map<String, int> metaCounters) Future<Map<String, int>>

Available on BaseChannel, provided by the Meta extension

Creates meta counters on this channel with metaCounters.
createMetaData(Map<String, String> metaData) Future<Map<String, String>>

Available on BaseChannel, provided by the Meta extension

Creates meta data on this channel with metaData.
createScheduledFileMessage(ScheduledFileMessageParams fileMessageParams, {OnScheduledMessageCallback<ScheduledFileMessage>? callback}) Future<ScheduledFileMessage>

Available on BaseChannel, provided by the Messages extension

Creates scheduled file message
createScheduledUserMessage(ScheduledUserMessageParams userMessageParams, {OnScheduledMessageCallback<ScheduledUserMessage>? callback}) Future<ScheduledUserMessage>

Available on BaseChannel, provided by the Messages extension

Creates scheduled user message
declineInvitation() Future<void>

Available on GroupChannel, provided by the GroupChannelOperations extension

Declines received invitation to join this channel.
decreaseMetaCounters(Map<String, int> metaCounters) Future<Map<String, int>>

Available on BaseChannel, provided by the Meta extension

Decreases meta counters on this channel with metaCounters.
decreaseUnreadMentionCount() → void

Available on GroupChannel, provided by the GroupChannelInternal extension

deleteAllMetaCounters() Future<void>

Available on BaseChannel, provided by the Meta extension

Deletes all meta counters
deleteAllMetaData() Future<void>

Available on BaseChannel, provided by the Meta extension

Deletes a meta data on this channel with key.
deleteChannel() Future<void>
Deletes this channel.
deleteMessage(int messageId) Future<void>

Available on BaseChannel, provided by the Messages extension

Deletes message with given messageId.
deleteMessageMetaArrayKeys(BaseMessage message, List<String> keys) Future<BaseMessage>

Available on BaseChannel, provided by the Meta extension

Deletes keys from MessageMetaArray given message.
deleteMetaCounters(String key) Future<void>

Available on BaseChannel, provided by the Meta extension

Deletes a meta counter with given key
deleteMetaData(String key) Future<void>

Available on BaseChannel, provided by the Meta extension

Deletes a meta data on this channel with key.
deletePoll({required int pollId, OnCompleteCallback? onCompleted}) Future<void>

Available on BaseChannel, provided by the Messages extension

Delete Poll
deletePollOption({required int pollId, required int pollOptionId, OnCompleteCallback? onCompleted}) Future<void>

Available on BaseChannel, provided by the Messages extension

Delete Poll Option
deleteReaction(BaseMessage message, String key) Future<ReactionEvent>

Available on BaseChannel, provided by the Reactions extension

Deletes reaction key from message
endTyping() → void

Available on GroupChannel, provided by the GroupChannelTyping extension

Stops to send typing signal.
freeze() Future<void>

Available on GroupChannel, provided by the GroupChannelConfiguration extension

Freezes this channel.
getAllMetaCounters() Future<Map<String, int>>

Available on BaseChannel, provided by the Meta extension

Retrieves all meta counters from this channel.
getAllMetaData() Future<Map<String, String>>

Available on BaseChannel, provided by the Meta extension

Retrieves all metaData from this channel.
getCachedMetaData() Map<String, String>

Available on BaseChannel, provided by the Meta extension

Returns cached meta data
getMember(String userId) Member?
Returns Member with given userId. It will return null if userId is not exist in members.
getMessageChangeLogs({int? timestamp, String? token, required MessageChangeLogParams params}) Future<MessageChangeLogsResponse>

Available on BaseChannel, provided by the Messages extension

Retreieve massage change logs with timestamp or token and params.
getMessagesById(int messageId, MessageListParams params) Future<List<BaseMessage>>

Available on BaseChannel, provided by the Messages extension

Retrieves a list of BaseMessage with given messageId and params.
getMessagesByTimestamp(int timestamp, MessageListParams params) Future<List<BaseMessage>>

Available on BaseChannel, provided by the Messages extension

Retrieves a list of BaseMessage with given timestamp and params.
getMetaCounters(List<String> keys) Future<Map<String, int>>

Available on BaseChannel, provided by the Meta extension

Retrieves meta counters from this channel with keys.
getMetaData(List<String> keys) Future<Map<String, String>>

Available on BaseChannel, provided by the Meta extension

Retrieves meta data from this channel with keys.
getMyMuteInfo() Future<MuteInfoResponse>

Available on BaseChannel, provided by the Moderations extension

Gets current user's mute information
getMyPushTriggerOption() Future<GroupChannelPushTriggerOption>

Available on GroupChannel, provided by the GroupChannelConfiguration extension

Returns current user's GroupChannelPushTriggerOption on this channel.
getPollChangeLogsSinceTimestamp(int ts, PollChangeLogsParams params) Future<PollChangeLogsResponse>
Retrieves Poll Changelogs through timestamp
getPollChangeLogsSinceToken(String? token, PollChangeLogsParams params) Future<PollChangeLogsResponse>
Retrieves Poll Changelogs through token
getReadMembers(BaseMessage message, {bool includeAll = false}) List<Member>

Available on GroupChannel, provided by the GroupChannelRead extension

Returns a list of Member who has read given message. If includeAll is provided as true then current user will be included as well.
getReadStatus(bool includeAll) Map<String, Map<String, dynamic>>

Available on GroupChannel, provided by the GroupChannelRead extension

Returns Map with key as userId String and value as Map that conatins two keys: user and last_seen_at. If includeAll is provided as true then current user will be included as well.
getTypingUsers() List<User>

Available on GroupChannel, provided by the GroupChannelTyping extension

Returns a list of User who are currently typing.
getUndeliveredMembers(BaseMessage message) List<Member>

Available on GroupChannel, provided by the GroupChannelRead extension

Returns undelivered member count as int with given message.
getUnreadMembers(BaseMessage message, {bool includeAll = false}) List<Member>

Available on GroupChannel, provided by the GroupChannelRead extension

Returns a list of Member who has not read given message. If includeAll is provided as true then current user will be included as well.
hideChannel({bool hidePreviousMessage = false, bool allowAutoUnhide = true}) Future<void>

Available on GroupChannel, provided by the GroupChannelConfiguration extension

Hides this channel.
increaseMetaCounters(Map<String, int> metaCounters) Future<Map<String, int>>

Available on BaseChannel, provided by the Meta extension

Increases meta counters on this channel with metaCounters.
increaseUnreadMentionCount() → void

Available on GroupChannel, provided by the GroupChannelInternal extension

increaseUnreadMessageCount() → void

Available on GroupChannel, provided by the GroupChannelInternal extension

inviteUsers(List<String> userIds) Future<void>

Available on GroupChannel, provided by the GroupChannelOperations extension

Invites one or more User with given userIds to this channel.
join({String? accessCode}) Future<void>

Available on GroupChannel, provided by the GroupChannelOperations extension

Joins this channel
leave({bool? shouldRemoveOperatorStatus}) Future<void>

Available on GroupChannel, provided by the GroupChannelOperations extension

Leaves this channel
markAsRead() Future<void>

Available on GroupChannel, provided by the GroupChannelRead extension

Marks as read with current time.
muteUser({required String userId, int seconds = -1, String? description}) Future<void>

Available on BaseChannel, provided by the Moderations extension

Mutes a user from this channel.
myReadReceipt() int

Available on GroupChannel, provided by the GroupChannelInternal extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyScreenshotWasTaken() Future<void>

Available on GroupChannel, provided by the GroupChannelConfiguration extension

Notifies screenshot was taken on this channel.
pinMessage(int messageId) Future<void>
Pin Message
removeAllOperators() Future<void>

Available on BaseChannel, provided by the BaseChannelConfiguration extension

Removes all operators on this channel.
removeFromCache() → void

Available on Cacheable, provided by the Operation extension

removeMember(String? userId) Member?

Available on GroupChannel, provided by the GroupChannelInternal extension

removeMessageMetaArray(BaseMessage message, List<MessageMetaArray> metaArrays) Future<BaseMessage>

Available on BaseChannel, provided by the Meta extension

Removes values from list of metaArrays with given message
removeOperators(List<String> userIds) Future<void>

Available on BaseChannel, provided by the BaseChannelConfiguration extension

Removes operators on this channel with given userIds.
reportChannel({required ReportCategory category, String? description}) Future<void>

Available on BaseChannel, provided by the Moderations extension

Reports this channel with category and description (optional)
reportMessage({required BaseMessage message, required ReportCategory category, String? description}) Future<void>

Available on BaseChannel, provided by the Moderations extension

Reports message with category and description (optional)
reportUser({required String userId, required ReportCategory category, String? description}) Future<void>

Available on BaseChannel, provided by the Moderations extension

Reports a User with category and description (optional)
resendFileMessage(FileMessage message, {required FileMessageParams params, OnFileMessageCallback? onCompleted, OnUploadProgressCallback? progress}) FileMessage

Available on BaseChannel, provided by the Messages extension

Resends failed FileMessage on this channel with message.
resendUserMessage(UserMessage message, {OnUserMessageCallback? onCompleted}) UserMessage

Available on BaseChannel, provided by the Messages extension

Resends failed UserMessage on this channel with message.
resetMyHistory() Future<void>

Available on GroupChannel, provided by the GroupChannelOperations extension

Resets (clear) any previous messages on this channel.
saveToCache() → void

Available on Cacheable, provided by the Operation extension

sendFileMessage(FileMessageParams params, {OnFileMessageCallback? onCompleted, OnUploadProgressCallback? progress}) FileMessage

Available on BaseChannel, provided by the Messages extension

Sends FileMessage on this channel with params.
sendScheduledMessageNow({required int scheduledMessageId, OnScheduledMessageSendNowCallback? callback}) Future<void>

Available on BaseChannel, provided by the Messages extension

Sends Scheduled Message Now
sendUserMessage(UserMessageParams params, {OnUserMessageCallback? onCompleted}) UserMessage

Available on BaseChannel, provided by the Messages extension

Sends UserMessage on this channel with params.
sendUserMessageWithText(String text, {OnUserMessageCallback? onCompleted}) UserMessage

Available on BaseChannel, provided by the Messages extension

Sends UserMessage on this channel with text.
setBlockedByMe({required String targetId, required bool blocked}) → void

Available on GroupChannel, provided by the GroupChannelInternal extension

setMyCountPreference(CountPreference countPreference) Future<void>

Available on GroupChannel, provided by the GroupChannelConfiguration extension

Sets current user's count preference with countPreference.
setMyPushTriggerOption(GroupChannelPushTriggerOption option) Future<void>

Available on GroupChannel, provided by the GroupChannelConfiguration extension

Sets current user's push trigger option on this channel.
shouldUpdateLastMessage(BaseMessage message, Sender? sender) bool

Available on GroupChannel, provided by the GroupChannelInternal extension

startTyping() → void

Available on GroupChannel, provided by the GroupChannelTyping extension

Starts to send typing signal.
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
inherited
translateUserMessage(UserMessage message, List<String> targetLanguages) Future<UserMessage>

Available on BaseChannel, provided by the Messages extension

Translates a message with given list of targetLanguages.
unbanUser({required String userId}) Future<void>

Available on BaseChannel, provided by the Moderations extension

Unbans a user from this channel
unfreeze() Future<void>

Available on GroupChannel, provided by the GroupChannelConfiguration extension

Unfreezes this channel.
unhideChannel() Future<void>

Available on GroupChannel, provided by the GroupChannelConfiguration extension

Unhides this channel
unmuteUser({required String userId}) Future<void>

Available on BaseChannel, provided by the Moderations extension

Unmutes user from this channel.
unpinMessage(int messageId) Future<void>
Unpin Message
updateChannel(GroupChannelParams params, {OnUploadProgressCallback? progress}) Future<GroupChannel>
Updates this channel with given params and optional progress.
updateFileMessage(int messageId, FileMessageParams params) Future<FileMessage>

Available on BaseChannel, provided by the Messages extension

Updates FileMessage on this channel with messageId and params.
updateMember(User? user) → void

Available on GroupChannel, provided by the GroupChannelInternal extension

updateMemberCounts(ChannelEvent event) → void

Available on GroupChannel, provided by the GroupChannelInternal extension

updateMetaCounters(Map<String, int> metaCounters) Future<Map<String, int>>

Available on BaseChannel, provided by the Meta extension

Updates meta counters on this channel with metaCounters.
updateMetaData(Map<String, String> metaData) Future<Map<String, String>>

Available on BaseChannel, provided by the Meta extension

Updates meta data on this channel with metaData.
updatePoll({required int pollId, required PollUpdateParams params, OnPollCallback? onCompleted}) Future<Poll>

Available on BaseChannel, provided by the Messages extension

Updates Poll
updatePollOption({required int pollId, required int pollOptionId, required String optionText, OnPollCallback? onCompleted}) Future<Poll>

Available on BaseChannel, provided by the Messages extension

Update Poll Option
updateScheduledFileMessage({required ScheduledFileMessageUpdateParams params, required int scheduledMessageid, OnScheduledMessageCallback<ScheduledFileMessage>? callback}) Future<ScheduledFileMessage>

Available on BaseChannel, provided by the Messages extension

Update scheduled file message
updateScheduledUserMessage({required ScheduledUserMessageUpdateParams params, required int scheduledMessageid, OnScheduledMessageCallback<ScheduledUserMessage>? callback}) Future<ScheduledUserMessage>

Available on BaseChannel, provided by the Messages extension

Update scheduled user message
updateTypingStatus(Member? member, {bool typing = false}) → void

Available on GroupChannel, provided by the GroupChannelInternal extension

updateUnreadCount(BaseMessage message) bool

Available on GroupChannel, provided by the GroupChannelInternal extension

updateUserMessage(int messageId, UserMessageParams params) Future<UserMessage>

Available on BaseChannel, provided by the Messages extension

Updates UserMessage on this channel with messageId and params.
updateWithSystemEventData(Map<String, dynamic> data) → void

Available on GroupChannel, provided by the GroupChannelInternal extension

votePoll({required int pollId, required List<int> pollOptionIds, OnPollVoteEventCallback? onCompleted}) Future<PollVoteEvent>

Available on BaseChannel, provided by the Messages extension

Cast/ Cancel Poll Vote

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

createChannel(GroupChannelParams params, {OnUploadProgressCallback? progress}) Future<GroupChannel>
#################### SECURITY TIPS #################### Before launching, you should review "Allow creating group channels from SDK" under ⚙️ Sendbird Dashboard -> Settings -> Security. It's turned on at first to simplify running samples and implementing your first code. Most apps will want to disable "Allow creating group channels from SDK" as that could cause unwanted operations. #################### SECURITY TIPS #################### Creates a channel with given params.
getChannel(String channelUrl) Future<GroupChannel>
Gets an GroupChannel with given channelUrl
refresh(String channelUrl) Future<GroupChannel>
Refreshes an GroupChannel with given channelUrl