pwa_update_listener 0.1.0 copy "pwa_update_listener: ^0.1.0" to clipboard
pwa_update_listener: ^0.1.0 copied to clipboard

A library for detecting if a new PWA version is avaiable

pwa_update_listener #

A Flutter package for checking if there is a new PWA version, and it is ready to be update.

Screen Shot 2021-08-18 at 22 15 28

Getting Started #

Wrap PwaUpdateListener around a widget in the main page. onReady will be called when the child widget is shown (eg. when a page is pop and the main page is shown) or when the app return from background.

Scaffold(
      body: PwaUpdateListener(
        onReady: () {
          /// Show a snackbar to get users to reload into a newer version
          ScaffoldMessenger.of(context).showSnackBar(
            SnackBar(
              content: Row(
                children: [
                  Expanded(child: Text('A new update is ready')),
                  TextButton(
                    onPressed: () {
                      reloadPwa();
                    },
                    child: Text('UPDATE'),
                  ),
                ],
              ),
              duration: Duration(days: 365),
              behavior: SnackBarBehavior.floating,
            ),
          );
        },
        child: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Text(
                'You have pushed the button this many times:',
              ),
              Text(
                '$_counter',
                style: Theme.of(context).textTheme.headline4,
              ),
            ],
          ),
        ),
      ),
    );
13
likes
120
pub points
81%
popularity

Publisher

unverified uploader

A library for detecting if a new PWA version is avaiable

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, visibility_detector

More

Packages that depend on pwa_update_listener