DEV Community

Cover image for Creating New/Old Flutter project with web support
Bharat Makwana
Bharat Makwana

Posted on

Creating New/Old Flutter project with web support

Today I will be guiding you to how to create flutter project with web support

There will be 2 portions of this article

1: Creating a project from scratch

2: Adding web support on an old project

Creating project from scratch

Before starting Make sure you are on flutter Dev channel if you are not

You need to switch to Dev or Master channel by hitting this command on your terminal

flutter channel dev

flutter channel master

Switching channel

Currently, I am on Dev channel

Enabling web support

To enable web support you have to write

flutter config — enable-web

It will enable experimental web support

Creating a Project

Now create a project as we usually do

You can see there is a web folder available

And we can run it on Google Chrome and Android emulator

Adding web support on existing project

(Create a backup of your project before doing anything)

As you know you need to switch to dev/master channel (if you are not)

flutter channel dev

flutter channel master

And Enable web support

flutter config — enable-web

Now open a terminal in your old flutter project directory and write

flutter create.

You can see web/index.html (created)

All done…

p.s - ”not all library is supported in flutter web so you might get some errors so take a backup of your project before performing these tasks”

Discussion (0)