Issue
Can output of dart2js (and angular2) be split into multiple packages and conditionally loaded during app runtime?
Similar to how RequireJS can do conditional loading of app parts/packages.
Example:
<button onClick="showAdminInterface()">ADMIN</button>
function showAdminInterface()
{
require(['myApp/AdminPackage'], function(pkg){
pkg.display();
});
}
Solution
Dart supports lazy loading of libraries and Angular2 also allows to use this feature.
For details see
- https://medium.com/@matanlurey/lazy-loading-with-angular-dart-14f58004f988#.fgko6q5aq
- http://news.dartlang.org/2014/08/dart-16-adds-support-for-deferred.html
Answered By – Günter Zöchbauer
Answer Checked By – Candace Johnson (FlutterFixes Volunteer)