문제

I'm running a web server with dart, it starts by:

dart server.dart

When I modified the project files, I hope this server can be restarted automatically. Is there any way to do it? Or is there any useful tool can help?

도움이 되었습니까?

해결책

Not natively in Dart until bug 3310 is implemented. There may well be external tools that will restart the command line when a file changes (open to other answers).

다른 팁

Just ran into this problem developing a dart server. For vscode IDE, following this stackoverflow suggestion I installed the Save and Run Ext extension and modified it for a dart command line program:

{
  "saveAndRunExt": {
    "commands": [
      {
        // "match": "\\.(css$|js$|html$)",
        "match": ".dart$",
        "isShellCommand": false,
        "cmd": "workbench.action.debug.restart",
        "isAsync": false
      },
      {
        "match": ".dart$",
        "isShellCommand": false,
        "cmd": "dart.rerunLastTestDebugSession"
      }
    ]
  }
}

This will restart the server in debug mode and rerun the last test debug session if any dart file is saved. Both server and test debug sessions work. Works great for me, at least on initial use of this extension.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top