fix(runtime): 同类 nullfix 脚本误加 ! 全库修复 - getCartInfoByBusiness 返回可空但末尾误加 !, 后接 if(x!=null) 判空. 影响: shopping_cart_bar/shopping_cart_widget/desktop_shopping_cart_widget(可空目标去!); shop_products/mobile shop(非空声明改 CartInfo?)
This commit is contained in:
@@ -24,7 +24,7 @@ class DesktopShoppingCartWidgetState extends State<DesktopShoppingCartWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
totalPrice = 0.0;
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business)!;
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
|
||||
if (cartInfo != null && cartInfo!.businessInfo!.id == widget.business.id) {
|
||||
totalPrice = cartInfo!.getTotalPrice();
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ class ShopProductsState extends State<ShopProducts> {
|
||||
itemBuilder: (BuildContext context, int i) {
|
||||
CategoryProducts cp = _categoryProducts[i];
|
||||
int qtyInCategory = 0;
|
||||
CartInfo cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, _business)!;
|
||||
CartInfo? cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, _business);
|
||||
if (cartInfo != null &&
|
||||
cartInfo.businessInfo!.id == _business.id &&
|
||||
cartInfo.productList != null) {
|
||||
|
||||
@@ -25,7 +25,7 @@ class ShoppingCartWidgetState extends State<ShoppingCartWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
totalPrice = 0.0;
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business)!;
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
|
||||
if (cartInfo != null && cartInfo!.businessInfo!.id == widget.business.id) {
|
||||
totalPrice = cartInfo!.getTotalPrice();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user