loginWithToken method

Future<void> loginWithToken(
  1. String userId,
  2. String token
)

~english Logs in to the chat server with a user ID and token. ~end

~chinese 使用用户 ID 和 Token 登录聊天服务器。 ~end

Implementation

Future<void> loginWithToken(String userId, String token) async {
  try {
    ChatLog.v('loginWithToken: $userId, ******');
    Map req = {'userId': userId, 'token': token};
    Map result = await platform_interface.Client.instance.callNativeMethod(
      ChatMethodKeys.login,
      req,
    );
    ChatError.hasErrorFromResult(result);
    _currentUserId = userId;
  } catch (e) {
    rethrow;
  }
}