'Is there a way to disable the app download option on flutter web?

When opening the application on a computer or browser in mobile a option for download or saving the page in desktop appear. There is some solution to disable this option?



Solution 1:[1]

You can add this to your <script> tag in your index.html:

window.addEventListener('beforeinstallprompt', function (e) {
    e.preventDefault();
    return false;
});

Solution 2:[2]

The following article highlights how this can be achieved.

Essentially you need to type the following into the terminal in the root directory of your project flutter config --no-enable-macos-desktop --no-enable-windows-desktop --no-enable-linux-desktop.

If successful you should get the following output:

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

To turn these settings on again you need to remove the nos from the command above.

https://www.kindacode.com/article/how-to-disable-web-and-desktop-support-in-flutter/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tyler2P
Solution 2