Is there any tool like gruntjs can convert dart to js when project file changes?


I’m looking for a tool like “gruntjs” which can monitor my dart project, and when file changes, it’s able to:

  1. convert dart files to javascript files
  2. restart my custom dart command: dart app.dart

I don’t find any plugin for gruntjs to do this, is there such a tool for dart?


You can use the Dart Editor Build System to build your own tool to this. Whenever a file changes Dart Editor looks for build.dart at the root of the project and attempts to run the commands in main(). In your build file you can invoke dart2js on your project, call your custom dart command and do whatever else is involved in building the project. This is how WebUI manages compilation of web components.

For more information on the Dart Editor Build System and for some example build.dart files see Build.dart and the Dart Editor Build System.

Answered By – Pixel Elephant

Answer Checked By – Mary Flores (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *