Does "show" take advantage of Dart imports other than intent and possibly compiler speed when importing the Dart library?

Let's say I have:

import 'dart:async' show Timer;
import 'dart:math' show Random;

      

I think one advantage is that you explicitly set your intentions, so if you try to use something else, you need to explicitly decide if you really like it.

I suppose another benefit is the speed of the compiler (dart2js), because despite the tree jitter, it can deal faster with what depends on it.

Does the runtime speed differ? Other benefits?

+3


source to share


1 answer


I can think of several:

  • It also reduces naming conflicts; unless you are importing a class Foo

    from a library because you don’t need it, you don’t need to fully qualify any other class Foo

    you might be using.
  • Reduces the clutter in your "workspace", which allows you to "accidentally" increase your linking to the library by simply "using what's in there" (this only stops you from referring to other classes / functions, it doesn't stop you from things that return them) ...
  • Similar to (2), but the intellisense list will be shorter, which can help you focus on the bits you care about.


Of course, the values ​​of each of them can differ from dev to dev.

Edit: Rereading the post, you already mentioned 2; however your quick compilations due to tree jitter are not entirely accurate. Just because you are not a show

class does not mean that you are not using it - it can be used internally via the code you are using or a function returned from you.

+3


source







All Articles