Posts

Showing posts from April, 2014

Speed Up Your Dart App's Initial Load With This Transformer

Image
I just saved potentially hundreds of blocking milliseconds from my Dart app's initial loads. By moving script tags, and using my new pub transformer, you can help your users, too.


Where does the time go? First, some background:

Typical Dart applications are designed to work in Dart VM and modern JavaScript. A small file, named dart.js, is loaded by the HTML file and checks to see what runtime is available. If the Dart VM is available, the Dart code is run. Otherwise, the dart.js file swaps out the Dart script for its equivalent JavaScript file compiled from the original Dart code.

Dart Editor can generate skeleton applications, complete with starter HTML, CSS, and Dart files. It's really handy for getting started quickly. As of today, the default starter HTML code looks something like this:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">