Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter upgrader, prompt showing only once

Tags:

flutter

I try to force users to upgrade app each time there is a new version with https://pub.dev/packages/upgrader. It works but only once, when there is a new version. When the dialog is opened and the user closes app. It won't ask again for update. Anyone has solution to that?

like image 838
karjan Avatar asked Dec 07 '25 10:12

karjan


2 Answers

the default value for upgrader to remind user to update app is 3 days if you want to change this time you can use durationUntilAlertAgain parameter

upgrader: Upgrader(                      
          durationUntilAlertAgain: const Duration(minutes: 5),
        ),

for exmaple: durationUntilAlertAgain: const Duration(minutes: 5),

in the above example if the user close app at 00:00 am and re-open it at 00:03 am the alert message will not appear however if user re-open it at 00:07 am or later the alert message will appear

alternatively you can force user to update the app by adding exit function to ignore or later button here is an example solve your question :

 UpgradeAlert(
        upgrader: Upgrader(             
          showLater: false,          
          onIgnore: () {
            SystemNavigator.pop();
             throw UnsupportedError('_');
          },
        ),
        child: HomePage(),
      ),
like image 63
milano zz Avatar answered Dec 08 '25 23:12

milano zz


How frequent do you want dialog to pop up? Upgrader widget accepts an attribute durationUntilAlertAgain and its accpetion object of Duration(). You pass whatever duration you want dialog will pop up after that duration.

like image 32
kamran khan Avatar answered Dec 09 '25 00:12

kamran khan