Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build flutter web app in debug mode?

Tags:

flutter-web

flutter build web will build my flutter app with obfuscation and minification.

I want my error stack to be readable though.

How should I modify the command?

like image 784
polina-c Avatar asked Jan 13 '20 03:01

polina-c


People also ask

Can you use Flutter to build Web App?

Build better web apps The web itself is a flexible platform, but Flutter is ideal for building web applications like PWAs or SPAs and bringing your existing mobile app to the web.

Can Flutter build PWA?

Flutter comes with the added advantage of web support as a PWA. With this, we can create a PWA of the mobile application that will run smoothly in the browser.

What is debug mode in flutter?

Debug mode for a web app means that: The build is not minified and tree shaking has not been performed. The app is compiled with the dartdevc compiler for easier debugging. By default, flutter run compiles to debug mode.

How do I build a web app in flutter?

Build an app with web support. Add web support to an existing project. To create a Flutter app with web support, you need the following software: Flutter SDK. See the Flutter SDK installation instructions. Chrome; debugging a web app requires the Chrome browser. Optional: An IDE that supports Flutter.

Does flutter compile the whole code?

But Flutter doesn’t do that. Instead of compiling the whole code again and again. Flutter team divides the compilation phase into three modes. First mode when you are developing the app, second mode when you are testing the performance of the app and third and the last mode is when you release the app.

How to run a Flutter App in release mode?

But if you want to switch to release mode , Use this command for running your app flutter run --release. or In Android Studio , click on : > Run. > Flutter Run 'main.dart' in Release Mode. Share. Improve this answer.


3 Answers

Try:

flutter build web --profile --dart-define=Dart2jsOptimization=O0

See:

https://github.com/flutter/flutter/blob/720dff6a94bd054e82ec4bf84b5cb802bbc52ddd/packages/flutter_tools/lib/src/build_system/targets/web.dart#L238-L239

like image 195
djpeinado Avatar answered Oct 11 '22 14:10

djpeinado


There's an issue on github for this feature, feel free to upvote ;)

https://github.com/flutter/flutter/issues/96283

like image 3
Xavier P Avatar answered Oct 11 '22 13:10

Xavier P


The only way I have found to do this is to use flutter run -d chrome. We would then need to locate where the files on disk are located.

like image 2
dazza5000 Avatar answered Oct 11 '22 15:10

dazza5000