uninstallService method

  1. @override
Future<bool> uninstallService()
override

卸载 Windows 系统服务。

仅 Windows 平台实现真正执行(UAC 提权调用 clash_sing_helper.exe uninstall 并轮询确认);其他平台返回 false

Implementation

@override
Future<bool> uninstallService() async {
  try {
    final io.Directory dir = await ProfileStorage().getStorageDirectory();
    final io.File helperExe = io.File(p.join(dir.path, WindowsConstants.helperFileName));
    if (!await helperExe.exists()) {
      return false;
    }
    final cli = _buildCli(dir);
    return cli.uninstall();
  } catch (e) {
    debugPrint('flutter_sing_box 插件卸载服务失败, $e');
    return false;
  }
}