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
}
or
GroupChannel.getChannel('1234').then((channel) {
//do seomthing with channel
}).catchError((e) {
//handle error
})
- Inheritance
-
- Object
- BaseChannel
- GroupChannel
- Available Extensions
- Annotations
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, 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
read / write
- channelType → ChannelType
-
Channel type for this channel
read-onlyinherited
- channelUrl ↔ String
-
This channel url
read / writeinherited
- coverUrl ↔ String?
-
cover image URL for this channel
read / writeinherited
- createdAt ↔ int?
-
timestamp when this channel is created
read / writeinherited
- creator ↔ User?
-
User who creates this channel
read / writeinherited
- customType ↔ String?
-
custom type for this channel
read / writeinherited
- data ↔ String?
-
custom data for this channel
read / writeinherited
- dirty ↔ bool
-
read / writeinherited
- fromCache ↔ bool
-
local usage
read / writeinherited
- hashCode → int
-
The hash code for this object.
read-onlyoverride
-
Hidden state of this channel
read / write
- invitedAt ↔ int
-
Timestamp when current user got a invitation
from other user in the channel
read / write
- inviter ↔ Member?
-
User who invited
read / write
- isBroadcast ↔ bool
-
True if this channel is broadcast
read / write
- isDiscoverable ↔ bool
-
True if this channel is discoverable
It is only for a public group channel.
read / write
- isDistinct ↔ bool
-
True if this channel is distinct
read / write
- isEphemeral ↔ bool
-
True if this channel is ephemeral
read / writeinherited
- isExclusive ↔ bool
-
True if this channel is exclusive
read / write
- isFrozen ↔ bool
-
Ture if this channel is frozen
read / writeinherited
- isHidden ↔ bool
-
True if this channel is hidden
read / write
- isPublic ↔ bool
-
True if this channel is public
read / write
- isStrict → bool
-
True if this channel is strict
final
- isSuper ↔ bool
-
True if this channel is super channel
read / write
- joinedAt ↔ int
-
Timestamp when current user joined on this channel
read / write
- joinedMemberCount ↔ int
-
Number of joined member
read / write
- key → String
-
read-onlyinherited
- lastMessage ↔ BaseMessage?
-
Last message of the channel
read / write
- lastPinnedMessage ↔ BaseMessage?
-
Last Pinned Message
read / write
- memberCount ↔ int
-
Number of members
read / write
-
members
↔ List<
Member> -
Channel members
Note: Number of member for SuperGroupChannel is limited to 10
read / write
- messageOffsetTimestamp ↔ int?
-
Message offset of this channel. User can only see messages after this 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.read / write - myCountPreference ↔ CountPreference
-
Message count preference of current user in this channel
The default value is all
read / write
- myLastRead ↔ int
-
A last read information for the current user
read / write
- myMemberState ↔ MemberState
-
Member state of current user in this channel
read / write
- myMutedState ↔ MuteState
-
Muted state of current user in this channel
read / write
- myPushTriggerOption ↔ GroupChannelPushTriggerOption
-
Push notification option for the current user to receive in the group channel
read / write
- myRole ↔ Role
-
Role of current user in this channel
read / write
- name ↔ String?
-
name for this channel
read / writeinherited
-
pinnedMessageIds
↔ List<
int> ? -
List of Pinned Message Ids
read / write
- pinnedMessagesUpdatedAt ↔ int
-
Time updated at Pinned Message
read / write
- primaryKey → String
-
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- unreadMentionCount ↔ int
-
The number of mentions that user does not read yet in the channel
read / write
- unreadMessageCount ↔ int
-
Unread message count of the channel
read / write
Methods
-
copyWith(
dynamic other) → void -
override
-
deleteChannel(
) → Future< void> - Deletes this channel.
-
getMember(
String userId) → Member? -
Returns Member with given
userId
. It will returnnull
ifuserId
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 non-existent 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 optionalprogress
.
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 givenchannelUrl
-
refresh(
String channelUrl) → Future< GroupChannel> -
Refreshes an
GroupChannel
with givenchannelUrl