Binders Lachel
Binders Lachel

Reputation: 635

How to develop a Dart library locally?

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?

Upvotes: 13

Views: 5748

Answers (3)

Oleg Novosad
Oleg Novosad

Reputation: 2421

You can specify also relatively with the name of the package, e.g.:

dependencies:
   my_other_package:
      path: ../my_other_package

Upvotes: 0

hopper
hopper

Reputation: 13390

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

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

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

Upvotes: 20

Alexandre Ardhuin
Alexandre Ardhuin

Reputation: 76193

You have to use path packages.

Upvotes: 2

Related Questions