create static method
Creates and gets an RtcChannel instance.
To join more than one channel, call this method multiple times to create as many RtcChannel instances as needed, and call the RtcChannel.joinChannel method of each created RtcChannel object. After joining multiple channels, you can simultaneously subscribe to streams of all the channels, but publish a stream in only one channel at one time.
Parameter channelId
The unique channel name for the MetaRTC session in the string format. The string length must be less than 64 bytes. This parameter does not have a default value. You must set it. Do not set it as the empty string "". Otherwise, the SDK returns ErrorCode.Refused. Supported character scopes are:
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- The space character.
- Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "
", "
", "^", "_", " {", "}", "|", "~", ",".
Implementation
static Future<RtcChannel> create(String channelId) async {
if (_channels.containsKey(channelId)) return _channels[channelId]!;
await _methodChannel.invokeMethod('create', {'channelId': channelId});
_channels[channelId] = RtcChannel._(channelId);
return _channels[channelId]!;
}