Skip to content

Instantly share code, notes, and snippets.

@sethladd
Created February 12, 2014 00:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sethladd/8947518 to your computer and use it in GitHub Desktop.
Save sethladd/8947518 to your computer and use it in GitHub Desktop.
Example of lazy loading with Dart.
import 'dart:async';
@lazy
import 'big_lib.dart' as big show soManyFunctions;
const lazy = const DeferredLibrary('big', uri: 'big.js');
void main() {
lazy.load().then((_) {
big.soManyFunctions();
});
}
library big;
soManyFunctions() {
print('from big library');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment