【发布时间】:2012-04-26 19:22:38
【问题描述】:
如何使用 Dart 创建库?
我想开始将我创建的一些 JavaScript(和其他语言)库移植到 Dart。
【问题讨论】:
如何使用 Dart 创建库?
我想开始将我创建的一些 JavaScript(和其他语言)库移植到 Dart。
【问题讨论】:
只要把它放在你的库文件中(第一名):
library mylibraryname;
然后您可以使用以下命令导入此库:
import "path/to/mylibraryname.dart";
其他选项可用,例如part,它充当包含。
如需更深入的教程,我向您推荐blog post from Dartwatch。
【讨论】:
stagehand是最简单的。
mkdir fancy_project
cd fancy_project
stagehand package-simple
console-full - A command-line application sample.
package-simple - A starting point for Dart libraries or applications.
server-shelf - A web server built using the shelf package.
web-angular - A web app with material design components.
web-simple - A web app that uses only core Dart libraries.
web-stagexl - A starting point for 2D animation and games.
如果您想在命令行上使用 Stagehand,请使用 pub global activate 安装它:
pub global activate stagehand
【讨论】: