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
-
- Object
- BaseChannel
- OpenChannel
- 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 ofmetaArrays
with givenmessage
. -
addOperators(
List< String> userIds) → Future<void> -
Available on BaseChannel, provided by the BaseChannelConfiguration extension
Adds operators on this channel with givenuserIds
. -
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 reactionkey
to givenmessage
-
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
Copiesmessage
totargetChannel
. -
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 withmetaCounters
. -
createMetaData(
Map< String, String> metaData) → Future<Map< String, String> > -
Available on BaseChannel, provided by the Meta extension
Creates meta data on this channel withmetaData
. -
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 withmetaCounters
. -
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 givenmessageId
. -
deleteMessageMetaArrayKeys(
BaseMessage message, List< String> keys) → Future<BaseMessage> -
Available on BaseChannel, provided by the Meta extension
Deleteskeys
from MessageMetaArray givenmessage
. -
deleteMetaCounters(
String key) → Future< void> -
Available on BaseChannel, provided by the Meta extension
Deletes a meta counter with givenkey
-
deleteMetaData(
String key) → Future< void> -
Available on BaseChannel, provided by the Meta extension
Deletes a meta data on this channel withkey
. -
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 reactionkey
frommessage
-
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 withtimestamp
ortoken
andparams
. -
getMessagesById(
int messageId, MessageListParams params) → Future< List< BaseMessage> > -
Available on BaseChannel, provided by the Messages extension
Retrieves a list of BaseMessage with givenmessageId
andparams
. -
getMessagesByTimestamp(
int timestamp, MessageListParams params) → Future< List< BaseMessage> > -
Available on BaseChannel, provided by the Messages extension
Retrieves a list of BaseMessage with giventimestamp
andparams
. -
getMetaCounters(
List< String> keys) → Future<Map< String, int> > -
Available on BaseChannel, provided by the Meta extension
Retrieves meta counters from this channel withkeys
. -
getMetaData(
List< String> keys) → Future<Map< String, String> > -
Available on BaseChannel, provided by the Meta extension
Retrieves meta data from this channel withkeys
. -
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 withmetaCounters
. -
isOperator(
String userId) → bool -
Returns
true
if a given user withuserId
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 -
removeMessageMetaArray(
BaseMessage message, List< MessageMetaArray> metaArrays) → Future<BaseMessage> -
Available on BaseChannel, provided by the Meta extension
Removes values from list ofmetaArrays
with givenmessage
-
removeOperators(
List< String> userIds) → Future<void> -
Available on BaseChannel, provided by the BaseChannelConfiguration extension
Removes operators on this channel with givenuserIds
. -
reportChannel(
{required ReportCategory category, String? description}) → Future< void> -
Available on BaseChannel, provided by the Moderations extension
Reports this channel withcategory
anddescription
(optional) -
reportMessage(
{required BaseMessage message, required ReportCategory category, String? description}) → Future< void> -
Available on BaseChannel, provided by the Moderations extension
Reportsmessage
withcategory
anddescription
(optional) -
reportUser(
{required String userId, required ReportCategory category, String? description}) → Future< void> -
Available on BaseChannel, provided by the Moderations extension
Reports a User withcategory
anddescription
(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 withmessage
. -
resendUserMessage(
UserMessage message, {OnUserMessageCallback? onCompleted}) → UserMessage -
Available on BaseChannel, provided by the Messages extension
Resends failed UserMessage on this channel withmessage
. -
saveToCache(
) → void -
sendFileMessage(
FileMessageParams params, {OnFileMessageCallback? onCompleted, OnUploadProgressCallback? progress}) → FileMessage -
Available on BaseChannel, provided by the Messages extension
Sends FileMessage on this channel withparams
. -
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 withparams
. -
sendUserMessageWithText(
String text, {OnUserMessageCallback? onCompleted}) → UserMessage -
Available on BaseChannel, provided by the Messages extension
Sends UserMessage on this channel withtext
. -
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 amessage
with given list oftargetLanguages
. -
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 optionalprogress
. -
updateFileMessage(
int messageId, FileMessageParams params) → Future< FileMessage> -
Available on BaseChannel, provided by the Messages extension
Updates FileMessage on this channel withmessageId
andparams
. -
updateMetaCounters(
Map< String, int> metaCounters) → Future<Map< String, int> > -
Available on BaseChannel, provided by the Meta extension
Updates meta counters on this channel withmetaCounters
. -
updateMetaData(
Map< String, String> metaData) → Future<Map< String, String> > -
Available on BaseChannel, provided by the Meta extension
Updates meta data on this channel withmetaData
. -
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 withmessageId
andparams
. -
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 optionalprogress
. -
getChannel(
String channelUrl) → Future< OpenChannel> -
Gets an OpenChannel with given
channelUrl
. -
refresh(
String channelUrl) → Future< OpenChannel> -
Refreshes an OpenChannel with given
channelUrl