September 2014 update: it is fixed!
Now Dart easily supports deferred loading using the special import... deferred syntax. For instance:
import analytics.dart deferred as analytics void main(){ analytics.loadLibrary.then((_) {
Here's the official tutorial on using lazy loading.
I'm afraid that what you are trying to do is still not possible (it is assumed that you are not using dart2js).
See this issue .
As Kasper said in comment 3, the deployment feature that you get with dart2dart has so far been discussed. The involvement of virtual machines in supporting this ends up giving dart2dart a generated access code for lazy downloads through a library call. This library API still needs to be specified.
If you use dart2js, this can be done. Here is a blog post on how to do this.
const lazy = const DeferredLibrary('reverser', uri: './part.js');
Which allows you to call lazy.load().then((_) { ...
source share