skip to Main Content

When the code is:

UpgradeAlert(
    child: Scaffold...
  )

Application detects new version in PlayStore and shows prompt.

When I add parameters:

UpgradeAlert(
  upgrader: Upgrader( messages: UpgraderMessages(code: 'pl'),
            showLater: false,
            showIgnore: false,
            durationUntilAlertAgain: Duration(minutes: 1), ),

child: Scaffold…
)

Application stops showing update alert, why?

Without "upgrader: Upgrader(…)," line works perfectly.

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    I solved the problem, when I declare parameters in variable:

        var upgrader = Upgrader(
      showLater: false,
      showReleaseNotes: false,
      messages: MessagesUpgrader(),
    )
    

    and...

    UpgradeAlert(
      upgrader: upgrader,
    

    Instead of placing it directly in UpgradeAlert

     UpgradeAlert(
      upgrader: Upgrader( messages: UpgraderMessages(code: 'pl'),
                showLater: false,
                showIgnore: false,
                durationUntilAlertAgain: Duration(minutes: 1), ),
    child: Scaffold... )
    

  2. I managed to solve my problem by not using localisations.

    This is the UpgradeAlert I’m using:

    var upgrader = Upgrader(
      showLater: false,
      showReleaseNotes: false,
      messages: MessagesUpgrader(),
    )
    
    GoRoute(
      path: '/login',
      builder: (context, state) => UpgradeAlert(
        upgrader: upgrader,
        navigatorKey: router.routerDelegate.navigatorKey,
        child: const LoginPage(),
      ),
    ),
    

    And this is inside the MessagesUpgrader():

    class MessagesUpgrader extends UpgraderMessages {
      MessagesUpgrader();
    
      @override
      String get buttonTitleIgnore => 'No';
    
      @override
      String get buttonTitleUpdate => 'Yes';
    
      @override
      String get body => 'Some text here in the body';
    
      @override
      String get prompt => 'Another text here';
    }
    

    Before I had localisations in the MessagesUpgrader and I had a BuildContext to fetch those texts—but if this class doesn’t refresh or rebuild, it works.

    Not really a solution but a workaround until this issue is fixed.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search