更新新版本不起作用
我有一个具有更新按钮的Flutter应用程序。这用于在Play Store中提供新版本时进行更新。直到几天之前,它都可以正常工作。但是现在它不起作用。它仅在用户安装相同版本时显示通知,否则将丢弃错误。
> 2022-07-04 12:01:39.072 27969-28023/? E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Bad state: No element
#0 ListMixin.firstWhere (dart:collection/list.dart:167)
#1 NewVersion._getAndroidStoreVersion (package:new_version/new_version.dart:157)
<asynchronous suspension>
#2 _SettingsPageState._checkVersion (package:bnews/ui_components/pages/settings_page.dart:196)
<asynchronous suspension>
因此,现在我无法使用此更新按钮更新我的应用程序。我使用new_version flutter软件包进行更新。 This is the code
void _checkVersion() async {
final newVersion = NewVersion(
androidId: "com.abc.def",
);
final status = await newVersion.getVersionStatus();
newVersion.showUpdateDialog(
context: context,
versionStatus: status!,
dialogTitle: "UPDATE!!!",
dialogText: "Please update the app from " + "${status.localVersion}" + " to " + "${status.storeVersion}",
updateButtonText: "Lets update",
);
}
I think package not found problem is there.但是直到几天前都可以正常工作。我还更新了new_version软件包,但仍然相同的问题。这是Playstore的问题吗?
I have a flutter app which has an update button. This is used to update when new version is available in play store. It works fine until few days before. But now it is not working. It only shows a notification when user has installed the same version otherwise an error will be thrown.
> 2022-07-04 12:01:39.072 27969-28023/? E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Bad state: No element
#0 ListMixin.firstWhere (dart:collection/list.dart:167)
#1 NewVersion._getAndroidStoreVersion (package:new_version/new_version.dart:157)
<asynchronous suspension>
#2 _SettingsPageState._checkVersion (package:bnews/ui_components/pages/settings_page.dart:196)
<asynchronous suspension>
So now I cant update my app using this update button. I use new_version flutter package to update. This is the code
void _checkVersion() async {
final newVersion = NewVersion(
androidId: "com.abc.def",
);
final status = await newVersion.getVersionStatus();
newVersion.showUpdateDialog(
context: context,
versionStatus: status!,
dialogTitle: "UPDATE!!!",
dialogText: "Please update the app from " + "${status.localVersion}" + " to " + "${status.storeVersion}",
updateButtonText: "Lets update",
);
}
I think package not found problem is there. But it works fine until few days before. I have also updated new_version package but still same problem. Is this problem with playstore?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是一个错误检查pub.dev new_version问题
this is a bug check pub.dev new_version issues
要检查是否有新版本,我使用 upgrader package ,只需包裹材料的主页它将处理一切:
for checking if there is a new version, I use upgrader package, just wrap the home of your materialApp and it will handle everything:
任何仍然遇到此问题的人都可以尝试一个新软件包 new_version_plus ,您可以通过仅通过更改相同的代码来通过更改相同的代码名字,很简单
Anyone who still face this issue can try a new package new_version_plus,you can use the same code by just changing name,its that simple