upgrader
upgrader copied to clipboard
BUG - Stream event not catch
Description
I'm currently facing some problem on the new evaluationStream
. I'm using appcast file and the widget UpgradeAlert
don't always receive the new boolean UpgraderEvaluateNeed
.
Does anyone have the same problem ??
Implementation
return UpgradeAlert(
navigatorKey: navigatorStateKey,
upgrader: Upgrader(
appcastConfig: AppcastConfiguration(
url: 'link',
supportedOS: ['android'],
),
debugLogging: true,
debugDisplayAlways: true,
durationUntilAlertAgain: Duration.zero,
),
child: child,
);
In the build of UpgradeAlert
widget , the streamBuilder don't seem to receive the last value of evaluationStream
. First value received is false, the one by default but in the function initialize
of the Upgrader
class if the streamController emit a new value true the streamBuilder is not update and don't check the version
Additional information
I/flutter ( 3703): upgrader: instantiated.
I/flutter ( 3703): upgrader: initialize called
I/flutter ( 3703): upgrader: build UpgradeAlert
I/flutter ( 3703): upgrader: initializing
I/flutter ( 3703): upgrader: languageCode: en
I/flutter ( 3703): upgrader: default operatingSystem: android XX
I/flutter ( 3703): upgrader: operatingSystem: android
I/flutter ( 3703): upgrader: isAndroid: true, isIOS: false, isLinux: false, isMacOS: false, isWindows: false, isFuchsia: false, isWeb: false
I/flutter ( 3703): upgrader: package info packageName: XX
I/flutter ( 3703): upgrader: package info appName: XX
I/flutter ( 3703): upgrader: package info version: 1.8.0
I/flutter ( 3703): upgrader: instantiated.
I/flutter ( 3703): upgrader: build UpgradeAlert
I/flutter ( 3703): upgrader: appcast item count: 1
I/flutter ( 3703): upgrader: appcast best item version: 1.8.1
I/flutter ( 3703): upgrader: appcast critical update item version: null
upgrader:
dependency: "direct main"
description:
name: upgrader
sha256: "889c1ece7af143df32e8ee2126f2ef17b2ab6bb7ed8fc3b1b022d7faa4fdab20"
url: "https://pub.dev"
source: hosted
version: "8.2.0"
I'm experiencing this too. Downgrading to version 7.1.0 seems to be a short term fix
I also found a solution using the last version by forcing the check :
final bool isInitialize = await upgrader.initialize();
final bool shouldDisplayUpgrade = upgrader.shouldDisplayUpgrade();
if (isInitialize && shouldDisplayUpgrade) {
upgrader.checkVersion(context: context);
}
Not really correct .. but it work
@Clement-Marchais-Wiztivi I tried but I am unable to reproduce this issue. Do you have any more details that might be helpful in understanding this problem? Is there any more of the upgrader log you can share? Is it possible that UpgradeAlert
is no longer in the widget tree?
Looks similar to my issue where willDisplayUpgrade
isn't called when the app starts after being started previously. This can easily be reproduced by using Hot Restart.
This was very noticeable for the user as the app would just show a loadingindicator forever, because in my implementation the app was blocked until it got this response (I want to be able to force upgrade). They had to kill the app and start it again to make it work.
My current production workaround is to wrap the UpgradeAlert in a 5 sec timeout, and just continue if there's no response, as well as logging this to Firebase. The last 7 days this happened about 350 times.
I'm testing a bit more now, and it seems like the issue is resolved by just calling upgrader.shouldDisplayUpgrade()
on the UpgradeAlert, as this triggers willDisplayUpgrade
. Not sure if this is the optimal solution though.