Created
February 12, 2014 00:35
-
-
Save sethladd/8947518 to your computer and use it in GitHub Desktop.
Example of lazy loading with Dart.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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