login method
Allows a user to log in the Agora RTM system.
The string length of userId must be less than 64 bytes with the following character scope:
- The 26 lowercase English letters: a to z
- The 26 uppercase English letters: A to Z
- The 10 numbers: 0 to 9
- Space
- "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "]", "[", "^", "_", " {", "}", "|", "~", "," Do not set userId as null and do not start with a space. If you log in with the same user ID from a different instance, you will be kicked out of your previous login and removed from previously joined channels.
Implementation
Future login(String? token, String userId) async {
final res = await _callNative("login", {'token': token, 'userId': userId});
if (res["errorCode"] != 0)
throw AgoraRtmClientException(
"login failed errorCode:${res['errorCode']}", res['errorCode']);
}