loginWithAgoraToken method Null safety
An app user logs in to the chat server by username and Agora token. This method supports automatic login.
See also: Another method to login to chat server is to login with user ID and token, See login.
Param userId The userId.
Param agoraToken The Agora token.
Throws A description of the exception. See ChatError.
Implementation
Future<void> loginWithAgoraToken(String userId, String agoraToken) async {
Map req = {
"username": userId,
"agora_token": agoraToken,
};
Map result = await ClientChannel.invokeMethod(
ChatMethodKeys.loginWithAgoraToken, req);
try {
ChatError.hasErrorFromResult(result);
_currentUserId = userId;
} on ChatError catch (e) {
throw e;
}
}