DEV Community

kyorohiro (kiyohiro kawamura)
kyorohiro (kiyohiro kawamura)

Posted on

Code-Server with Dart and Flutter Web On VPS

In this section, I explain How to create a Develop environment for flutter for web on cloud.

and,
you can use vscode plugin too.

Run Code-server on vps

$ apt-get update
$ curl -fsSL https://code-server.dev/install.sh | sh
$ systemctl enable --now code-server@root
// Created symlink /etc/systemd/system/default.target.wants/code-server@root.service → /lib/systemd/system/code-server@.service.
Enter fullscreen mode Exit fullscreen mode

Setup password (Optional)

$ vi /root/.config/code-server/config.yaml
Enter fullscreen mode Exit fullscreen mode
bind-addr: 0.0.0.0:8080
auth: password
password: MyFlutter-0213f
cert: false                                                     
Enter fullscreen mode Exit fullscreen mode
$ systemctl restart code-server@root
Enter fullscreen mode Exit fullscreen mode

Alt Text

Install Flutter

https://flutter.dev/docs/get-started/install/linux

$ apt-get install curl -y
$ apt-get install git -y
$ apt-get install unzip -y
$ apt-get install zip -y
$ git clone https://github.com/flutter/flutter.git
$ export PATH="$PATH:`pwd`/flutter/bin"
$ flutter doctor
Enter fullscreen mode Exit fullscreen mode

Install Flutter Web

https://flutter.dev/docs/get-started/web

$ flutter channel beta
$ flutter upgrade
$ flutter config --enable-web
$ flutter devices
Enter fullscreen mode Exit fullscreen mode

Run Sample Program

$ flutter create myapp
$ cd myapp
$ flutter build web
$ flutter run -d web-server  --web-port=18080 --web-hostname=0.0.0.0
Enter fullscreen mode Exit fullscreen mode

Top comments (5)

Collapse
 
sharaddition profile image
Sharaddition

Is there any way to run it in play-with-docker.com? I'm unable to locate dart-sdk

Collapse
 
kyorohiro profile image
kyorohiro (kiyohiro kawamura)

sorry.. I have never used play-with-docker.com.
Umm.., The following sites may be helpful to you.

Collapse
 
bpmct profile image
Ben Potter

Love this! Where are you hosting your code-server?

Collapse
 
kyorohiro profile image
kyorohiro (kiyohiro kawamura)

Conoha!!
conoha.jp/

It is a famous VPS service in Japan

Collapse
 
chrisca93099037 profile image
Chris Cap⚡🌱

Very interesting, it works well.... But how to run as another user than root ?