简体   繁体   English

在Dart中导入库的顶级成员

[英]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? 仅导入模块一部分的以下Python语法的Dart等效项是什么? This imports just urlopen from the urllib2 module. 这仅从urllib2模块导入urlopen

from urllib2 import urlopen

To import only a part of a library, you can do the following. 要仅导入库的一部分,可以执行以下操作。 This imports only foo and bar : 这仅导入foobar

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

And this imports everything except foo : 这将导入 foo 外的所有内容:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM