Is there any way to improve Dart (dart2js) compile times?

Issue

I’m trying to move from TypeScript to Dart. TypeScript compiles almost immediately – Dart takes more than 5 seconds to compile a Hello World program! Am I missing something? Are there any possible ways to improve that?

Solution

This is usually not much of an issue when developing with Dart because Dartium, a Chromium derivative executes Dart directly.

Only for testing compatibility with other browsers and for deployment it is necessary to build to JavaScript.

pub serve a Dart development web server does dart-to-js compilation on-the-fly with a lot of caching which usually improves transpilation times for reloads (after some warmup time) if you need JS during development with non-Dartium browsers.

Answered By – Günter Zöchbauer

Answer Checked By – David Marino (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.