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
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
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

copyWith(dynamic other) → void
override
deleteChannel() Future<void>
Deletes this channel.
getMember(String userId) Member?
Returns Member with given userId. It will return null if userId is not exist in members.
getPollChangeLogsSinceTimestamp(int ts, PollChangeLogsParams params) Future<PollChangeLogsResponse>
Retrieves Poll Changelogs through timestamp
getPollChangeLogsSinceToken(String? token, PollChangeLogsParams params) Future<PollChangeLogsResponse>
Retrieves Poll Changelogs through token
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pinMessage(int messageId) Future<void>
Pin Message
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
inherited
unpinMessage(int messageId) Future<void>
Unpin Message
updateChannel(GroupChannelParams params, {OnUploadProgressCallback? progress}) Future<GroupChannel>
Updates this channel with given params and optional progress.

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