importing dart code from other projects

Saturday, July 5, 2014

I think this may have been covered, but I'm missing something incredibly basic that I think other people asking or answering assume.

I have two dart project's I've created, one is a web app and the other is a command line app.

Web App Project wants to use classes and code from cmdline-code-ive-written.dart from the Command Line Project

I go into Web App Project and type the following:

import '../../command-line-project/bin/cmdline-code-ive-written.dart';

Now: I know this isn't a good idea because it's a fragile path. But the Web App compiles.

The problem is, when it runs, I get the following:

[web] GET /character.dart => Could not find asset WebApp|web/cmdline-code-ive-written.dart

And the Web App code fails to run.

I've read this:

about Pub, which helpfully warns me NOT to do the ../ thing and instead advises me to import a package -- but I'm not sure how to make my code a package.