GroupChannel class Null safety

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


GroupChannel.getChannel('1234').then((channel) {
  //do seomthing with channel
}).catchError((e) {
  //handle error
Available Extensions


GroupChannel({BaseMessage? lastMessage, bool isSuper = false, bool isStrict = false, bool isBroadcast = false, bool isPublic = false, bool isDistinct = false, bool isDiscoverable = 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})
WARNING: Do not use default constructor to initialize manually
GroupChannel.fromJson(Map<String, dynamic> json)
GroupChannel.fromJsonAndCached(Map<String, dynamic> json, {int? ts})


accessCodeRequired bool
True if this channel is required access code
@JsonKey(defaultValue: false), read / write
channelType ChannelType
Channel type for this channel
read-only, inherited
channelUrl String
This channel url
read / write, inherited
coverUrl String?
cover image URL for this channel
read / write, inherited
createdAt int?
timestamp when this channel is created
read / write, inherited
creator User?
User who creates this channel
read / write, inherited
customType String?
custom type for this channel
read / write, inherited
data String?
custom data for this channel
read / write, inherited
dirty bool
@JsonKey(ignore: true), read / write, inherited
fromCache bool
local usage
@JsonKey(ignore: true), read / write, inherited
hashCode int
The hash code for this object. [...]
read-only, override
hiddenState GroupChannelHiddenState
Hidden state of this channel
@JsonKey(defaultValue: GroupChannelHiddenState.unhidden, unknownEnumValue: GroupChannelHiddenState.unhidden), read / write
invitedAt int
Timestamp when current user got a invitation from other user in the channel
@JsonKey(defaultValue: 0), read / write
inviter Member?
User who invited
read / write
isBroadcast bool
True if this channel is broadcast
@JsonKey(defaultValue: false), final
isDiscoverable bool
True if this channel is discoverable It is only for a public group channel.
@JsonKey(defaultValue: false), read / write
isDistinct bool
True if this channel is distinct
@JsonKey(defaultValue: false), read / write
isEphemeral bool
True if this channel is ephemeral
@JsonKey(defaultValue: false), read / write, inherited
isFrozen bool
Ture if this channel is frozen
@JsonKey(defaultValue: false, name: 'freeze'), read / write, inherited
isHidden bool
True if this channel is hidden
@JsonKey(defaultValue: false), read / write
isPublic bool
True if this channel is public
@JsonKey(defaultValue: false), read / write
isStrict bool
True if this channel is strict
@JsonKey(defaultValue: false), final
isSuper bool
True if this channel is super channel
@JsonKey(defaultValue: false), final
joinedAt int
Timestamp when current user joined on this channel
@JsonKey(name: 'joined_ts', defaultValue: 0), read / write
joinedMemberCount int
Number of joined member
@JsonKey(defaultValue: 0), read / write
key String
read-only, inherited
lastMessage BaseMessage?
Last message of the channel
read / write
memberCount int
Number of members
@JsonKey(defaultValue: 0), read / write
members List<Member>
Channel members Note: Number of member for SuperGroupChannel is limited to 10
@JsonKey(defaultValue: const []), read / write
messageOffsetTimestamp int?
Message offset of this channel. User can only see messages after this offset
@JsonKey(name: 'ts_message_offset'), read / write
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.
@JsonKey(defaultValue: -1), read / write
myCountPreference CountPreference
Message count preference of current user in this channel The default value is all
@JsonKey(defaultValue: CountPreference.all, name: 'count_preference'), read / write
myLastRead int
A last read information for the current user
@JsonKey(defaultValue: 0, name: 'user_last_read'), read / write
myMemberState MemberState
Member state of current user in this channel
@JsonKey(defaultValue: MemberState.none, name: 'member_state'), read / write
myMutedState MuteState
Muted state of current user in this channel
@JsonKey(fromJson: booltoMuteState, name: 'is_muted'), read / write
myPushTriggerOption GroupChannelPushTriggerOption
Push notification option for the current user to receive in the group channel
@JsonKey(defaultValue:, name: 'push_trigger_option'), read / write
myRole Role
Role of current user in this channel
@JsonKey(defaultValue: Role.none, unknownEnumValue: Role.none), read / write
name String?
name for this channel
read / write, inherited
primaryKey String
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
unreadMentionCount int
The number of mentions that user does not read yet in the channel
@JsonKey(defaultValue: 0), read / write
unreadMessageCount int
Unread message count of the channel
@JsonKey(defaultValue: 0), read / write


copyWith(dynamic other) → void
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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
registerScheduledUserMessage(ScheduledUserMessageParams params) Future<ScheduledUserMessage>
Registers a ScheduledUserMessage with given params.
toJson() Map<String, dynamic>
toString() String
A string representation of this object. [...]
updateChannel(GroupChannelParams params, {OnUploadProgressCallback? progress}) Future<GroupChannel>
Updates this channel with given params and optional progress. [...]


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

Static Methods

createChannel(GroupChannelParams params, {OnUploadProgressCallback? progress}) Future<GroupChannel>
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