renewAgoraToken method
- String agoraToken
当用户在声网 token 登录状态时,且在 ConnectionEventHandler.onTokenWillExpire 实现类中收到 token 即将过期事件的回调通知可以调用这个 API 来更新 token,避免因 token 失效产生的未知问题。
Param agoraToken 新声网 Token.
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError。
Implementation
Future<void> renewAgoraToken(String agoraToken) async {
try {
Map req = {"agora_token": agoraToken};
Map result = await platform_interface.Client.instance
.callNativeMethod(ChatMethodKeys.renewToken, req);
ChatError.hasErrorFromResult(result);
} catch (e) {
rethrow;
}
}