fix(runtime): 37 late fields with == null checks were wrongly migrated -> nullable. Fixes LateInitializationError crashes on page navigation (shop/checkout/comment/data pages)
This commit is contained in:
@@ -35,21 +35,21 @@ class ShoppingCartBar extends StatefulWidget {
|
||||
}
|
||||
|
||||
class ShoppingCartBarState extends State<ShoppingCartBar> {
|
||||
late CartInfo cartInfo;
|
||||
CartInfo? cartInfo;
|
||||
double totalPrice = 0.0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
totalPrice = 0.0;
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business)!;
|
||||
if (cartInfo != null && cartInfo.businessInfo!.id == widget.business.id) {
|
||||
totalPrice = cartInfo.getTotalPrice();
|
||||
if (cartInfo != null && cartInfo!.businessInfo!.id == widget.business.id) {
|
||||
totalPrice = cartInfo!.getTotalPrice();
|
||||
}
|
||||
|
||||
Widget cartContent;
|
||||
|
||||
if (cartInfo == null || (cartInfo.businessInfo!.id != widget.business.id)
|
||||
|| (totalPrice == 0.0 && cartInfo.productList!.length == 0)) {
|
||||
if (cartInfo == null || (cartInfo!.businessInfo!.id != widget.business.id)
|
||||
|| (totalPrice == 0.0 && cartInfo!.productList!.length == 0)) {
|
||||
cartContent = Center(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(20.0),
|
||||
@@ -92,8 +92,8 @@ class ShoppingCartBarState extends State<ShoppingCartBar> {
|
||||
},
|
||||
),
|
||||
);
|
||||
for (var i = 0; i < cartInfo.productList!.length; i++) {
|
||||
(cartContent as Column).children.add(cartLineItem(cartInfo.productList![i], i));
|
||||
for (var i = 0; i < cartInfo!.productList!.length; i++) {
|
||||
(cartContent as Column).children.add(cartLineItem(cartInfo!.productList![i], i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user