Flutter build web

5.8k Views Asked by At

I'm new in flutter and I want to build web application by flutter web,flutter build apk is worked for me, but when I run Flutter build web I have this error.

I followed up every step according to this document and use // @dart=2.9 top of all of my class that has error null check.

do you have any idea about this problem?!

2

There are 2 best solutions below

0
On BEST ANSWER

use these command--->

flutter channel beta
flutter config --enable-web
flutter create .

After creating you will find a web folder in your project

restart IDE or Editor if needed. Note: You must have google chrome

flutter devices

there you will be found your chrome then simply run or use the command ->

flutter run -d chrome
0
On

You must use the channel master for flutter in order to build web version, more details here.

In resume, do:

flutter channel master
flutter upgrade
flutter config --enable-web

After that, just run flutter build web and then, go in root_of_your_app/build/web and run a web server inside like python with python -m http.server 8000 and go to http://localhost:8000 to see your app on any browsers.