Creative Bracket

Quick Tip: Automatically generate the scaffolding for your next project

Producing the necessary files and configuration each time you start a new project setup could become tiresome. This is the case especially when you’re setting nothing different from a previous project.

In this quick tip, I’d like to show you a quicker alternative to getting a Dart project up and running using a package named stagehand.

Stagehand is a Dart project scaffolding generator inspired by mainstream tools like Web Starter Kit and Yeoman.

Now assuming you have Dart version 2 already installed(brew install dart --devel), you can grab stagehand 3.0 by running the below command:

pub global activate stagehand

This will pull down the package from the pub package management repo. Then take a look at the generator template options by running:

stagehand

At this present time you could generate these templates:

  1. console-full – A command-line application sample.
  2. package-simple – A starting point for Dart libraries or applications.
  3. server-shelf – A web server built using the shelf package.
  4. web-angular – A web app with material design components.
  5. web-simple – A web app that uses only core Dart libraries.
  6. web-stagexl – A starting point for 2D animation and games.

So let’s say we wanted to generate the scaffolding for an AngularDart application. We can do this by running the commands below:

mkdir awesome_dart_project
cd awesome_dart_project
stagehand web-angular # or whichever template

And this gives us the below with further instructions in the output:

Generated files and folders for Angular Dart project

That’s it for today’s quick tip. Now how about you give it a go 🙂?

Subscribe to my YouTube channel for the latest videos on Dart, thanks!

Like, share and follow me 😍 for more articles on Dart.

Quick links

  1. Stagehand package
  2. Dart install instructions
  3. Free Dart screencasts on Egghead.io

Jermaine Oppong

Hello 👋, I show programmers how to build full-stack web applications with the Dart SDK. I am passionate about teaching others, having received tremendous support on sites like dev.to and medium.com for my articles covering various aspects of the Dart language and ecosystem.

Useful learning materials