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:
- 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 and follow me 😍 for more articles on Dart.
Top comments (3)
More awesome stuff, Jermaine! So glad to see you contributing all this fantastic content geared toward Dart beginners.
One small thing: I run dart.academy, and more than 60% of that site's visitors are using Windows, which means a substantial number of Dart devs (or at least people interested in Dart) are using that OS. It'd be great if you provided instructions that work universally wherever possible. Fortunately, most things are already like that once you get past installation, but for the installation step, if you don't want to detail every possible way to do it, you could just link to the Dart site's more comprehensive instructions, as one approach.
Keep up the great work. Can't wait to see what you put out next. :)
Hey Monty, great to see you here after our Medium conversation and thanks for detailing the numbers of your Windows users. Apologies for the neglect of Windows. Will definitely be tailoring my content to be as universal as possible.
Yes, thanks! And of course, you were right on Medium. Only optional positional parameters can map directly to private properties. Couldn't reply on there to say that. ;)