Search code examples
flutterwebflutter-web

check if flutter web app (PWA) has already installed added to homescreen?


I did a lot of searching on the internet but did not find any results for these questions Is there a way to find out in the Flutter app that this app has been added to the home screen?


Solution

  • You can check if the window is a standalone.

    import 'dart:html';
    
    final isStandAlone = window.matchMedia('(display-mode: standalone)').matches;
    
    if (isStandAlone) {
        // Ask user to install PWA
    }