How to create libraries for Dart?

Just put this in your library file (first place):

library mylibraryname;

You can then import this lib with:

import "path/to/mylibraryname.dart";

Other options are available, for example part which acts as include.

For a more in-depth tutorial I recommend you this blog post from Dartwatch.


stagehand is the most simply.

Usage

mkdir fancy_project
cd fancy_project
stagehand package-simple

Stagehand templates

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.

Installation

If you want to use Stagehand on the command line, install it using pub global activate:

pub global activate stagehand

Tags:

Dart

Dartium