stopService method

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

停止 Windows 系统服务(helper 内部走 HTTP API 同步关闭)。

Implementation

@override
Future<bool> stopService() 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.stop();
  } catch (e) {
    debugPrint('flutter_sing_box 插件停止服务失败, $e');
    return false;
  }
}