简体   繁体   English

Flutter 发布 APK 行为异常

[英]Flutter Release APK misbehaving

i am developing an ecommerce app which works very fine in debug mode,but surprisingly after generating a signed release apk it does not work well.我正在开发一个电子商务应用程序,它在调试模式下工作得很好,但令人惊讶的是,在生成一个签名的发布 apk 后,它不能很好地工作。 SCENARIO.设想。 when i add items to cart for the first time after starting an app,items are added to cart and cart length is updated on top of cart icon.but after opening cart page(view items in the cart),this starts to misbehave,items are added into cart but cart length no longer updates unless i do refresh the page,also all buttons inside cart page (delete items from the cart button, add product quantity and reduce product quantity buttons.) does not work until i get out of cart page and come back again.当我在启动应用程序后第一次将商品添加到购物车时,商品被添加到购物车并且购物车长度在购物车图标的顶部更新。但是在打开购物车页面(查看购物车中的商品)之后,这开始出现异常,商品已添加到购物车但购物车长度不再更新,除非我刷新页面,购物车页面内的所有按钮(从购物车按钮中删除项目,添加产品数量和减少产品数量按钮。)在我离开购物车之前不起作用页,然后再次返回。 also, after opening cart page,other provider functions like filtering subcategories inside a category also does not work until some refresh.此外,在打开购物车页面后,其他提供程序功能(如在类别中过滤子类别)也需要刷新才能使用。 However these does not happen in debug mode,just only in release mode.但是,这些不会在调试模式下发生,只会在发布模式下发生。 Iam using provider for State management.我正在使用提供商进行 State 管理。 what's a possible cause for this problem.i would appreciate any help这个问题的可能原因是什么。我将不胜感激任何帮助

You are using a "global" provider function which is not called when the state changes.您正在使用“全局”提供程序 function,当 state 更改时不会调用它。 In your case, the issue is that you are calling the provider function on a non-existing instance of the provider class. This is the reason why the code works in debug mode.在您的情况下,问题是您在提供程序 class 的一个不存在的实例上调用提供程序 function。这就是代码在调试模式下工作的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM