logout method

Future<V2TimCallback> logout()

登出

退出登录,如果切换账号,需要 logout 回调成功或者失败后才能再次 login,否则 login 可能会失败。

Implementation

Future<V2TimCallback> logout() async {
  if (kIsWeb) {
    V2TimCallback res = await TencentCloudChatSdkPlatform.instance.logout();
    if (res.code == 0) {
      currentLoginInfo.remove(currentLoginUserIDKey);
      currentLoginInfo.remove(currentLoginSigKey);
    }

    return res;
  }

  V2TimCallback res = await TIMManager.instance.logout();
  if (res.code == 0) {
    currentLoginInfo.remove(currentLoginUserIDKey);
    currentLoginInfo.remove(currentLoginSigKey);
  }

  return res;
}