# Dart Web
###### tags: `Work`
https://dart.dev/tutorials/web/get-started
# Installation
## 1. Dart Install
``` linux=
$ brew tap dart-lang/dart
$ brew install dart
```
## 2. Command line install
If you like to use the command line, install webdev.
``` linux=
dart pub global activate webdev
```
>After running this command, you will obtain an export path, which should be filled in either Bash or zsh.[color=red]
>Ex: export PATH="$PATH":"$HOME/.pub-cache/bin"
>If not done, you will not be able to use **webdev** command.
**Set export in Bash or zsh:**
>Use echo $SHELL to confirm which terminal environment you are currently using, such as Bash, zsh
>Open the configuration file for the terminal environment:
>1. Bash: open ~/.bash_profile
>2. zsh: open ~/.zshrc[color=pink]
# Dart Version
What if you want to use another version of dart?
## Steps towards dart versioning
>1. Make sure **which version** you are going to use.
>2. Can use `brew install dart@2.13.4` command
Note: This command will look up for the version, if not found it will recommend possible versions to choose.

>3. Install using `brew install dart@2.13`, this one will provide you an export directory.

>4. The obtained export directory must be put inside **Bash or zsh** depending on which is used in your own computer.
>5. Open a **new** terminal after adding export and use `dart --version` to check if version is corrected.[color=pink]
## Notes
* Everytime you have to change dart version, remember to change **Bash or zsh**.
# Getting Started
## 1. Create project
``` linux=
dart create -t web projectname
```
## 2. Run the app
To run the app from the command line, use webdev to build and serve the app:
``` linux=
cd projectfolder
webdev serve
```
>**IMPORTANT**[color=red]
To view your app, use the **Chrome browser** to visit the app’s URL—for example, localhost:8080.
>
>Whether you use an IDE or the command line, webdev serve builds and serves your app using the Dart development compiler, dartdevc. Startup is slowest the first time dartdevc builds and serves your app. After that, assets are cached on disk and incremental builds are much faster.
## 3. Folder Structure
Code will be shown in **web folder**, and the main file is **main.dart**.
web folder will be composed by: (1) index.html, (2) main.dart, (3) style.css
## 4. Change & Display
You will not have to recompile the app, just save up all your changes and refresh your page in Chrome.
brew install rbenv/tap/openssl@1.0