pwa_update_listener

Last updated:

0 purchases

pwa_update_listener Image
pwa_update_listener Images
Add to Cart

Description:

pwa update listener

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

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,
),
],
),
),
),
);
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.