如何在本地开发Dart库? [英] How to develop a Dart library locally?

查看:155
本文介绍了如何在本地开发Dart库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可能会发生月食,但是我很难做最简单的事情:编写一个简单的库并使用它。 (我想在本地完成所有操作,而不发布库等)。

I might be having a mental eclipse, but it's hard for me to do the simplest thing: write a simple library and use it. (I want to do this all locally, without publishing the library, etc.)

我已经浏览了发布命令,而且似乎都没有在本地安装软件包,那么如何在其他项目中使用它?

I've browsed through the list of pub commands and none seems to install a package locally, so how can I use it in other projects?

例如,我只是克隆了该库,并希望在本地对其进行测试以查看其是否有效。我该怎么办?

For example, I just cloned this library and would like to test it locally to see if it works. How can I do that?

推荐答案

要使用本地库,可以指定您的发布规范中的本地文件路径,例如:

To use a local library, you can specify a local filepath in your pubspec, such as:

dependencies:
  transmogrify:
    path: /Users/me/transmogrify

使用本地依赖项时,Dart将自动获取所有更改,因此无需运行特殊的 pub 命令。

When using a local dependency, Dart will pick up any changes automatically, so there's no need to run a special pub command.

这篇关于如何在本地开发Dart库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆