Shailen Tuli
Shailen Tuli

Reputation: 14191

Importing a top-level member of a library in Dart

What is the Dart equivalent of the following Python syntax for importing just a part of a module? This imports just urlopen from the urllib2 module.

from urllib2 import urlopen

Upvotes: 1

Views: 76

Answers (1)

Shailen Tuli
Shailen Tuli

Reputation: 14191

To import only a part of a library, you can do the following. This imports only foo and bar:

import 'package:lib1/lib1.dart' show foo, bar; 

And this imports everything except foo:

import 'package:lib2/lib2.dart' hide foo;

Upvotes: 5

Related Questions