Say I've got:
import 'dart:async' show Timer;
import 'dart:math' show Random;
I think one benefit is that you explicitly set your intentions, so later if you try to use something else you have to explicitly decide whether you'd in fact like to.
I imagine another benefit is compiler speed (dart2js), because even though there is tree shaking, it can perform faster knowing right-off what's depended on.
Does it benefit speed at runtime? Other benefits?
I can think of a few:
Foo
class from the library because you don't need it, you won't need to fully qualify any other Foo
class you might be using.Of course, the values of each of these may differ from dev to dev.
Edit: Re-reading your post, you already mentioned 2; however your faster compilations due to tree-shaking isn't quite accurate. Just because you didn't show
a class, doesn't mean you don't use it - it could be used internally by code you do use, or returned from a function to you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With