Running Dart for Web in Windows
Lemwell Jake P.
Full-Stack Developer, Entrepreneur and creator of Collideborate app | Excellence lies in details
I know the documentation was already exist on Dart website but most of the documentations "assumed" that you know "this" and "that". So, I'll try to solve that problem here. Let's dive-in on how to run Dart for Web in Windows platform.
Install Dart-SDK using Chocolatey
Head over to chocolatey website and follow the instruction on how to install chocolatey. This amazing application is like a composer for PHP or pip for Python.
Don't forget to run the terminal in Administrative mode when you don't have Powershell. I recommend this approach of installing the Dart-SDK compare the Gekorm.
Get CLI tools or an IDE (or both)
Install webdev and stagehand. Your CLI buddies.
C:\>pub global activate webdev
C:\>pub global activate stagehand
Stagehand helps you get your Dart projects set up. It is a Dart project scaffolding generator. Webdev will do build and serve for the app.
The available commands for stagehand are the following:
console-full - A command-line application sample.
package-simple - A starting point for Dart libraries or applications. (We are going to use this one later)
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
Create a web app
Create a new folder and name it dart-app. To create a web app from the command line, use these commands:
C:\dart-app>stagehand web-simple
C:\dart-app>pub get
Note that pub get is like composer install in PHP.
Let's run the app
To run the app from the command line, use webdev to build and serve the app:
C:\dart-app>webdev serve
Now open your browser and visit https://localhost:8080.
Note that webdev serve is like php artisan serve in Laravel and php yii serve in Yii
Reference: https://jakepucan.blogspot.com/2019/05/running-dart-for-web-in-windows.html