Does compiled AngularDart pollutes global scope or overrides Standard objects of the browser?


I’m looking for a framework that will allow me to write a SPA and a embeddable library. I would love to have a way to share component between both. So I’m looking for a solution that has relatively small amount of potential conflicts with other frameworks and with AngularDart it self. Including case when library has been included using script tab, yes two versions of AngularDart on the same page. A framework that has less Global Objects, no Standard Object overrides, no Global Event handling and limited polyfill conflicts.

Dart and AngularDart seams what I need, but I also need more details and docs to validate my assumptions. Anything you are able to point out would be very helpful and greatly appreciated (issues, PR, blogs , roadmap, commits, specs, docs)

It’s possible to run multiple AngularDart apps on the same page. I’ve tested AngularDart todo example app embedded in itself. But I need more details on what dart2js is doing and how compiler avoids global scope pollution.


Yes, AngularDart should be well suited for your requirements.

Dart itself shouldn’t pollute your scope at all, you can try running dart2js on something trivial (like just print inside main) and verify the code – it creates a closure and executes it, so nothing inside is accessible from outside. There is also no patching of any global JS objects, so you can run it alongside anything without interference. If it’s not the case file a bug.

You can run as many AngularDart applications on a single page as you wish. To get them fully isolated you can compile each one separately with dart2js, then they wouldn’t be able to access any of each other internals whatsoever.

Answered By – rkj

Answer Checked By – Cary Denson (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *