0

this code works

 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}",

);}}

but this code is not working

 void _checkVersion()async{
final newVersion=NewVersion(
  androidId: "com.whatsapp",
);
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}",

);}}

E/flutter ( 2974): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: NoSuchMethodError: The method '[]' was called on null. E/flutter ( 2974): Receiver: null

Please can you help me ?

  • I think the `newVersion` is returned null so the checking on this `newVersion.getVersionStatus()` could not be completed right, – Tabarek Ghassan Jun 17 '22 at 07:24

1 Answers1

2

androidId: "com.whatsapp" is working now. The Error "The method '[]' was called on null" comes with android id when we forget to mention "Release Note" while uploading aab to google play console. Above Error only occurs when NewVersion is unable to find release note thus returns null