Flutter应用程序仅在进入一个特定屏幕时崩溃。

huangapple go评论98阅读模式
英文:

Flutter app crashes on entering one particular screen only

问题

我正在开发一款电子商务应用,在进入产品详情页面时,应用程序在加载时卡住,一段时间后崩溃,没有显示任何特定的与应用程序相关的错误,我无法识别并处理,后端也没有错误,API响应完全正常。

这在Android模拟器和iOS模拟器上都发生了,在真实设备上也是一样的。

控制台日志显示 -

I/scudo ( 7103): Scudo OOM: 进程已耗尽11664大小类的256M内存。

Flutter应用程序仅在进入一个特定屏幕时崩溃。

有人可以帮忙吗?

英文:

I'm developing an e-commerce application, and on entering the product details screen, the app gets stuck at loading , and then crashes after a while, it doesn't show any specific app related, error which I can recognize and work on, neither is there any error on tha backend, the API responses load perfectly.

And this happens on both Android emulators and iOS simulator, same on real devices as well.

The console logs shows -

I/scudo   ( 7103): Scudo OOM: The process has exhausted 256M for size class 11664.

Flutter应用程序仅在进入一个特定屏幕时崩溃。

Can anyone please help with this?

答案1

得分: 0

尝试运行:

dart pub cache clean

和:

flutter clean

然后运行:

dart pub upgrade

尝试为目标平台重新构建你的项目。

希望它能够正常工作 🤞

英文:

Try running:

dart pub cache clean

and:

flutter clean

Then run:

dart pub upgrade

and try rebuilding your project for the target platform.

I hope it works 🤞

答案2

得分: 0

我认为问题出在你的productDetailsProvider上。由于你没有提供关于它的详细信息,我认为你的代码在成功获取后没有将状态设置为“ProductDetailsSuccessState”,然后它一直保持在加载状态。

英文:

I believe that the problem is in your productDetailsProvider. Since you did not provide the detail about it, I think your code did not set the state to ProductDetailsSuccessState after fetching successfully and you then it kept loading

答案3

得分: 0

所以问题已解决,是我一直在使用的ListView.builder用于显示产品评论(这部分我最不希望成为问题的部分),深藏在我的小部件树中,实际上是导致问题的原因!

英文:

So solved it, it was a ListView.builder I had been using to show the product reviews(the section which I was least expecting to be the culprit), nested deep inside my widget tree that was actually causing the issue!

huangapple
  • 本文由 发表于 2023年7月3日 15:12:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/76602572.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定