logout method

void logout ({bool unbindToken: false, dynamic onSuccess(), dynamic onError(int code, String desc) })

退出登录. unbindToken true 解除推送绑定 : false 不解除绑定 如果退出登录成功,请调用onSuccess,如果出现错误,请调用onError

Implementation

void logout(
    {bool unbindToken = false, onSuccess(), onError(int code, String desc)}) {
  Future<Map> result = _emClientChannel
      .invokeMethod(EMSDKMethod.logout, {"unbindToken": unbindToken});
  result.then((response) {
    if (response['success']) {
      if (onSuccess != null) onSuccess();
    } else {
      if (onError != null) onError(response['code'], response['desc']);
    }
  });
}