Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 483
Akhil Avatar asked Jan 22 '26 21:01

Akhil


2 Answers

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.

like image 55
Akhil Avatar answered Jan 25 '26 14:01

Akhil


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}",
      );}}
like image 27
Ke1212 Avatar answered Jan 25 '26 15:01

Ke1212



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!