Mimicking build_runner serve on a nodeJs server


With the expiration of Dartium that happened just a few days ago, I felt compelled to migrate from dart 1.24.3 to Dart2, even though it is still in dev.

I have although hit a few walls doing so, one of them being related to the architecture of my apps.

I run a nodeJs server, which also acts as a webserver with client side dart.
The problem that I experience with the new dart SDK is that in order for the .dart files to be read in Chrome, they must be served using webdev serve or build_runner serve.

Obviously, these 2 commands act as the file server, which is not what I want since I’m using a nodeJS server.

By using build_runner watch I think I am enabling the build and watch of the .dart files into .dart.js inside of the following directory :


I am also able to serve them from my nodeJS server. What remains is the package directory, I can’t seem to find where pub serves gets the following package files:


Does anyone know what build_runner serve does to include them?

Thank you,


There are 2 options for using a different server during development.

  1. Run build_runner serve on a different port and proxy the requests to it from your other server. This has the benefit of delaying requests while a build is ongoing so you don’t get an inconsistent set of assets.
  2. Run build_runner watch --output web:build and use the created build/ directory to serve files from. This will include a build/packages directory that has these files in it.

Answered By – Nate Bosch

Answer Checked By – Terry (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.