且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何导入文件夹中的所有文件?

更新时间:2022-12-08 14:21:26

如果我有一个文件名数组,需要导入每个库。 >

您可以做的是创建一个导入所有其他库并将其重新导出的库。

然后,您可以导入此一个库,并获取导入的所有库

  library all_in_one; 

export library1.dart;
export library2.dart;
export library3.dart;


Say I got a bunch of dart scripts in a folder,

Is there anything I can do like import 'foo/*.dart'?

P.S. What if I got an array of filenames and wanna import those files?

You need to import each library individually.

What you can do is to create a library that imports all other libraries and reexports them.
you can then import this one library and get all libraries imported at once.

library all_in_one;

export library1.dart;
export library2.dart;
export library3.dart;