OpenChannel class

Represents open 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 = OpenChannel.getChannel('1234');
   //do something with channel
} catch (e) {
   //handle error
}

or

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

Constructors

OpenChannel.new({required int participantCount, required List<User> operators, 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
OpenChannel.fromJson(Map<String, dynamic> json)
factory
OpenChannel.fromJsonAndCached(Map<String, dynamic> json, {int? ts})
factory

Properties

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
entered bool
getter/setter pair
fromCache bool
local usage
getter/setter pairinherited
hashCode int
The hash code for this object.
no setteroverride
isEphemeral bool
True if this channel is ephemeral
getter/setter pairinherited
isFrozen bool
Ture if this channel is frozen
getter/setter pairinherited
key String
no setterinherited
name String?
name for this channel
getter/setter pairinherited
operators List<User>
Operators of this channel
getter/setter pair
participantCount int
Number of participants in this channel
getter/setter pair
primaryKey String
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

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 others) → 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
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.
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
enter() Future<void>

Available on OpenChannel, provided by the OpenChannelOperations extension

Enters to this channel
exit() Future<void>

Available on OpenChannel, provided by the OpenChannelOperations extension

Exits from 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
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
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.
isOperator(String userId) bool
Returns true if a given user with userId is operator
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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
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

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.
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.
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
unmuteUser({required String userId}) Future<void>

Available on BaseChannel, provided by the Moderations extension

Unmutes user from this channel.
updateChannel(OpenChannelParams params, {OnUploadProgressCallback? progress}) Future<OpenChannel>
Updates an OpenChannel 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.
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
updateUserMessage(int messageId, UserMessageParams params) Future<UserMessage>

Available on BaseChannel, provided by the Messages extension

Updates UserMessage on this channel with messageId and params.
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(OpenChannelParams params, {OnUploadProgressCallback? progress}) Future<OpenChannel>
Creates an OpenChannel with given params and optional progress.
getChannel(String channelUrl) Future<OpenChannel>
Gets an OpenChannel with given channelUrl.
refresh(String channelUrl) Future<OpenChannel>
Refreshes an OpenChannel with given channelUrl