Akhil
Akhil

Reputation: 668

new_version package returns null flutter

i tried to show a dialog box to users if in case a newer version is released.I have used new_version package version : 0.3.0. But im recieving a warning.enter image description here

  void _checkVersion()async{
  final newVersion=NewVersion(
  final status=await newVersion.getVersionStatus();
  if(status?.canUpdate==true){
    newVersion.showUpdateDialog(
  context: context,
  versionStatus: status!,
  allowDismissal: false,
  dialogTitle: "UPDATE",
      dialogText: "Please update the app from ${status.localVersion} to ${status.storeVersion}",
);}}

enter image description here

Upvotes: 3

Views: 4140

Answers (4)

Alex le Goff
Alex le Goff

Reputation: 189

{FIXED} I found how to fix the problem. I was using the "new_version" package and I changed to "new_version_plus" and the bug is no longer there!

PS: add this: if(status?.localVersion != status?.storeVersion) { newVersion.showUpdateDialog(

Upvotes: 0

Akhil
Akhil

Reputation: 668

Anyone who still faces this issue can try a new package new_version_plus, you can use the same code by just changing the name, it works completely fine.

Upvotes: 6

Pushkar Mishra
Pushkar Mishra

Reputation: 31

make sure you are not forgetting to mention "Release Note" while uploading aab to google play console. when NewVersion is unable to find release note it returns null

Upvotes: 1

Ke1212
Ke1212

Reputation: 129

you are missing the package name as value in androidId key if working on android to let the new Version function check and compare .Below is the Updated code

 void _checkVersion()async{
    final newVersion=NewVersion(
      androidId: "com.snapchat.android",
    );
    final status=await newVersion.getVersionStatus();
    if(status?.canUpdate==true){
      newVersion.showUpdateDialog(
        context: context,
        versionStatus: status!,
        allowDismissal: false,
        dialogTitle: "UPDATE",
        dialogText: "Please update the app from ${status.localVersion} to ${status.storeVersion}",
      );}}

Upvotes: 2

Related Questions