1

Opening Flutter Gallery web app

the user get prompted to add the app to the home screen as shown below

for both desktop

and mobile

what steps should I follow to achieve this without messing with JS (js answer)

Thank you

Francesco Iapicca
  • 2,618
  • 5
  • 40
  • 85

1 Answers1

0

While the popup in the image that you have mentioned , that is automatic .It automatically fires up when you meet several criteria (and which are always true for flutter web apps , mentioned here) .

code :

if ('serviceWorker' in navigator) {
  window.addEventListener('load', function () {
    navigator.serviceWorker.register('flutter_service_worker.js');
  });
}

which is present in index.html handles the pwa functionality

Aman Verma
  • 818
  • 5
  • 17