Channel class

This a the class that manages a specific channel.

Constructors

Channel(Client _client, String type, String _id, Map<String, dynamic> _extraData)
Create a channel client instance.
Channel.fromState(Client _client, ChannelState channelState)
Create a channel client instance from a ChannelState object

Properties

cid String
Channel cid
read-only
cidStream Stream<String>
Channel cid as a stream
read-only
client Client
The main Stream chat client
read-only
config ChannelConfig
Channel configuration
read-only
configStream Stream<ChannelConfig>
Channel configuration as a stream
read-only
createdAt DateTime
Channel creation date
read-only
createdAtStream Stream<DateTime>
Channel creation date as a stream
read-only
createdBy User
Channel user creator
read-only
createdByStream Stream<User>
Channel user creator as a stream
read-only
deletedAt DateTime
Channel deletion date
read-only
deletedAtStream Stream<DateTime>
Channel deletion date as a stream
read-only
extraData Map<String, dynamic>
Channel extra data
read-only
extraDataStream Stream<Map<String, dynamic>>
Channel extra data as a stream
read-only
frozen bool
Channel frozen status
read-only
frozenStream Stream<bool>
Channel frozen status as a stream
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
id String
Channel id
read-only
idStream Stream<String>
Channel id as a stream
read-only
initialized Future<bool>
True if this is initialized Call watch to initialize the client or instantiate it using Channel.fromState
read-only
isMuted bool
Returns true if the channel is muted
read-only
lastMessageAt DateTime
Channel last message date
read-only
lastMessageAtStream Stream<DateTime>
Channel last message date as a stream
read-only
memberCount int
Channel member count
read-only
memberCountStream Stream<int>
Channel member count as a stream
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
state ChannelClientState
This client state
read / write
type String
The channel type
read / write
updatedAt DateTime
Channel updated date
read-only
updatedAtStream Stream<DateTime>
Channel updated date as a stream
read-only

Methods

acceptInvite([Message message]) Future<AcceptInviteResponse>
Accept invitation to the channel
addMembers(List<Member> members, Message message) Future<AddMembersResponse>
Add members to the channel
banUser(String userID, Map<String, dynamic> options) Future<EmptyResponse>
Bans a user from the channel
create() Future<ChannelState>
Creates a new channel
delete() Future<EmptyResponse>
Delete this channel. Messages are permanently removed.
deleteFile(String url) Future<EmptyResponse>
Delete a file from this channel
deleteImage(String url) Future<EmptyResponse>
Delete an image from this channel
deleteReaction(Message message, Reaction reaction) Future<EmptyResponse>
Delete a reaction from this channel
dispose() → void
Call this method to dispose the channel client
getMessagesById(List<String> messageIDs) Future<GetMessagesByIdResponse>
Retrieves a list of messages by ID
getReactions(String messageID, PaginationParams options) Future<QueryReactionsResponse>
List the reactions for a message in the channel
getReplies(String parentId, PaginationParams options) Future<QueryRepliesResponse>
List the message replies for a parent message
hide({bool clearHistory: false}) Future<EmptyResponse>
Hides the channel from Client.queryChannels for the user until a message is added If clearHistory is set to true - all messages will be removed for the user
inviteMembers(List<Member> members, Message message) Future<InviteMembersResponse>
Invite members to the channel
keyStroke() Future<void>
First of the EventType.typingStart and EventType.typingStop events based on the users keystrokes. Call this on every keystroke.
markRead() Future<EmptyResponse>
Mark all channel messages as read
mute({Duration expiration}) Future<EmptyResponse>
Mutes the channel
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
on([String eventType, String eventType2, String eventType3, String eventType4]) Stream<Event>
Stream of Event coming from websocket connection specific for the channel Pass an eventType as parameter in order to filter just a type of event
query({Map<String, dynamic> options: const {}, PaginationParams messagesPagination, PaginationParams membersPagination, PaginationParams watchersPagination}) Future<ChannelState>
Query the API, get messages, members or other channel fields
queryMembers({Map<String, dynamic> filter, List<SortOption> sort, PaginationParams pagination}) Future<QueryMembersResponse>
Query channel members
rejectInvite([Message message]) Future<RejectInviteResponse>
Reject invitation to the channel
removeMembers(List<Member> members, Message message) Future<RemoveMembersResponse>
Remove members from the channel
sendAction(Message message, Map<String, dynamic> formData) Future<SendActionResponse>
Send action for a specific message of this channel
sendEvent(Event event) Future<EmptyResponse>
Send an event on this channel
sendFile(MultipartFile file) Future<SendFileResponse>
Send a file to this channel
sendImage(MultipartFile file) Future<SendImageResponse>
Send an image to this channel
sendMessage(Message message) Future<SendMessageResponse>
Send a message to this channel
sendReaction(Message message, String type, {Map<String, dynamic> extraData: const {}}) Future<SendReactionResponse>
Send a reaction to this channel
show() Future<EmptyResponse>
Removes the hidden status for the channel
stopTyping() Future<void>
Sets last typing to null and sends the typing.stop event
stopWatching() Future<EmptyResponse>
Stop watching the channel
toString() String
Returns a string representation of this object.
inherited
translateMessage(String messageId, String language) Future<TranslateMessageResponse>
Retrieves a list of messages by ID
truncate() Future<EmptyResponse>
Removes all messages from the channel
unbanUser(String userID) Future<EmptyResponse>
Remove the ban for a user in the channel
unmute() Future<EmptyResponse>
Unmutes the channel
update(Map<String, dynamic> channelData, Message updateMessage) Future<UpdateChannelResponse>
Edit the channel custom data
watch([Map<String, dynamic> options = const {}]) Future<ChannelState>
Loads the initial channel state and watches for changes

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited