joinChannelWithUserAccount method Null safety

Future<void> joinChannelWithUserAccount(
  1. String? token,
  2. String channelName,
  3. String userAccount,
  4. [ChannelMediaOptions? options]
)

Joins the channel with a user account.

After the user successfully joins the channel, the SDK triggers the following callbacks:

Note

  • To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type.

Parameter token The token generated at your server. Set it as the token generated at your server. For details, see Get a token.

Parameter channelName The channel name. The maximum length of this parameter is 64 bytes. 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: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".

Parameter userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null.

  • 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: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".

Parameter options The channel media options: ChannelMediaOptions.

Implementation

@override
Future<void> joinChannelWithUserAccount(
    String? token, String channelName, String userAccount,
    [ChannelMediaOptions? options]) {
  return _invokeMethod('joinChannelWithUserAccount', {
    'token': token,
    'channelName': channelName,
    'userAccount': userAccount,
    'options': options?.toJson(),
  });
}