startService method

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

启动已安装的 Windows 系统服务。

Implementation

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