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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
totalPrice = 0.0;
|
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) {
|
if (cartInfo != null && cartInfo!.businessInfo!.id == widget.business.id) {
|
||||||
totalPrice = cartInfo!.getTotalPrice();
|
totalPrice = cartInfo!.getTotalPrice();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class ShopProductsState extends State<ShopProducts> {
|
|||||||
itemBuilder: (BuildContext context, int i) {
|
itemBuilder: (BuildContext context, int i) {
|
||||||
CategoryProducts cp = _categoryProducts[i];
|
CategoryProducts cp = _categoryProducts[i];
|
||||||
int qtyInCategory = 0;
|
int qtyInCategory = 0;
|
||||||
CartInfo cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, _business)!;
|
CartInfo? cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, _business);
|
||||||
if (cartInfo != null &&
|
if (cartInfo != null &&
|
||||||
cartInfo.businessInfo!.id == _business.id &&
|
cartInfo.businessInfo!.id == _business.id &&
|
||||||
cartInfo.productList != null) {
|
cartInfo.productList != null) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class ShoppingCartWidgetState extends State<ShoppingCartWidget> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
totalPrice = 0.0;
|
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) {
|
if (cartInfo != null && cartInfo!.businessInfo!.id == widget.business.id) {
|
||||||
totalPrice = cartInfo!.getTotalPrice();
|
totalPrice = cartInfo!.getTotalPrice();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1136,8 +1136,8 @@ class ShopState extends State<Shop>
|
|||||||
itemBuilder: (BuildContext context, int i) {
|
itemBuilder: (BuildContext context, int i) {
|
||||||
CategoryProducts cp = _categoryProducts![i];
|
CategoryProducts cp = _categoryProducts![i];
|
||||||
int qtyInCategory = 0;
|
int qtyInCategory = 0;
|
||||||
CartInfo cartInfo =
|
CartInfo? cartInfo =
|
||||||
Utils.getCartInfoByBusiness(store.state.cartInfos, _business!)!;
|
Utils.getCartInfoByBusiness(store.state.cartInfos, _business!);
|
||||||
if (cartInfo != null &&
|
if (cartInfo != null &&
|
||||||
cartInfo.businessInfo!.id == _business!.id &&
|
cartInfo.businessInfo!.id == _business!.id &&
|
||||||
cartInfo.productList != null) {
|
cartInfo.productList != null) {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class ShoppingCartBarState extends State<ShoppingCartBar> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
totalPrice = 0.0;
|
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) {
|
if (cartInfo != null && cartInfo!.businessInfo!.id == widget.business.id) {
|
||||||
totalPrice = cartInfo!.getTotalPrice();
|
totalPrice = cartInfo!.getTotalPrice();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user