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({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

copyWith(dynamic others) → void
override
deleteChannel() Future<void>
Deletes this channel
isOperator(String userId) bool
Returns true if a given user with userId is operator
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
inherited
updateChannel(OpenChannelParams params, {OnUploadProgressCallback? progress}) Future<OpenChannel>
Updates an OpenChannel with given params and optional progress.

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