Skip to content
pubscout

pwa_install

0.0.6, released 2 years ago by joemuller.com

Prompt mobile web users to install the Flutter app as a PWA on demand.

WASM-ready
$ flutter pub add pwa_install
Source repository

What it does

The package captures the browser's beforeinstallprompt event and exposes a singleton API to check if the prompt is available and to trigger it. It lets you show the install prompt from a button or any user action.

AI-written summary of version 0.0.6, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need a custom install button for a Flutter web app running on mobile browsers
  • You want to control when the PWA install prompt appears rather than relying on the browser's automatic prompt

Skip it when

  • Your app is not deployed to the web or targets only native platforms
  • You rely on native app store distribution instead of PWA

Strengths

  • Simple, small API
  • Works across all Chromium‑based mobile browsers that support PWAs
  • No extra permissions or native code required

Weaknesses

  • Only works on browsers that fire beforeinstallprompt
  • Requires manual addition of a script to web/index.html
  • No fallback for unsupported browsers

Setup

Kind
Flutter widgets
Effort
Medium
Code generation
No
Direct dependencies
1

Add the provided <script> block to web/index.html, then call PWAInstall().setup() (optionally with an installCallback) before runApp() in main.dart

Future<void> main() async {
  PWAInstall().setup(installCallback: () => debugPrint('APP INSTALLED!'));
  runApp(MaterialApp(home: Scaffold(body: ElevatedButton(
    onPressed: () {
      if (PWAInstall().installPromptEnabled) {
        PWAInstall().promptInstall_();
      }
    },
    child: Text('Install PWA'),
  ))));
}

Alternatives

Packages that do the same job and could replace pwa_install.