How to disable Web and Desktop support in Flutter

Updated: April 23, 2023 By: Pennywise 4 comments

If your goal with Flutter is just to build apps for Android and iOS, then you can disable web and desktop-related things. This makes your projects a little cleaner and lighter.

Solution

Web

In order to disable web in your future projects, execute this command:

flutter config --no-enable-web

You will see:

Setting "enable-web" value to "false".

From now on, your NEW projects will not have a folder named “web”:

Desktop

To disable macOS, Windows, and Linux all at once, run:

flutter config --no-enable-macos-desktop --no-enable-windows-desktop --no-enable-linux-desktop

Output:

Setting "enable-linux-desktop" value to "false".
Setting "enable-macos-desktop" value to "false".
Setting "enable-windows-desktop" value to "false".

If you want to disable it separately for each operating system, try the following commands.

macOS:

flutter config --no-enable-macos-desktop

Windows:

flutter config --no-enable-windows-desktop

Linux:

flutter config --no-enable-linux-desktop

You can see more options and flags by running:

flutter config

To make sure everything works as expected, you should restart all of your open code editors (VS Code, Notepad, etc).

What if you want to enable Web and Desktop again?

If one day you want to make a web app with Flutter, you can enable it again by running:

flutter config --enable-web

The same goes for the desktop stuff:

flutter config --enable-macos-desktop
flutter config --enable-windows-desktop
flutter config --enable-linux-desktop

Conclusion

You’ve explored how to get rid of web and desktop stuff when creating a new Flutter project. Keep the ball rolling and continue learning more fascinating things by reading also:

You can also check out our Flutter topic page or Dart topic page for the latest tutorials and examples.

Subscribe
Notify of
guest
4 Comments
Inline Feedbacks
View all comments
Ayman
Ayman
2 years ago

it’s working thank you

Faheem Ahmad
Faheem Ahmad
2 years ago

how to disable ios

A Goodman
Admin
A Goodman
2 years ago
Reply to  Faheem Ahmad

You can try: flutter config –no-enable-ios

Vitor
Vitor
2 years ago

Thank you, i loved this article <3

Related Articles