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:
At this present time you could generate these 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.
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:
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.