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:
2026-08-01 01:58:36 +08:00
parent b49fb59db4
commit 0526baa3c8
32 changed files with 317 additions and 317 deletions

View File

@@ -31,7 +31,7 @@ class MobileNewComment extends StatefulWidget {
}
class MobileNewCommentState extends State<MobileNewComment> {
late Comment comment;
Comment? comment;
late bool _showProgress;
@@ -167,8 +167,8 @@ class MobileNewCommentState extends State<MobileNewComment> {
children: <Widget>[],
);
if (comment != null && comment.images!.length > 0) {
for (ProductImage image in comment.images!) {
if (comment != null && comment!.images!.length > 0) {
for (ProductImage image in comment!.images!) {
row.children.add(
Container(
padding: EdgeInsets.only(left: 10.0),
@@ -239,7 +239,7 @@ class MobileNewCommentState extends State<MobileNewComment> {
child: Icon(
Icons.add,
size: 60.0,
color: comment == null || comment.images!.length < 3 ? Colors.lightBlue : Colors.black12,
color: comment == null || comment!.images!.length < 3 ? Colors.lightBlue : Colors.black12,
),
decoration: BoxDecoration(
color: Colors.white70,
@@ -264,13 +264,13 @@ class MobileNewCommentState extends State<MobileNewComment> {
),
),
onTap: () {
if (comment == null || comment.images!.length < 3) {
if (comment == null || comment!.images!.length < 3) {
showDialog(
context: mainContext,
barrierDismissible: true,
builder: (BuildContext context) {
return Util().getPicture(mainContext, store.state.user!,
commentId: comment != null ? comment.id! : 0,
commentId: comment != null ? comment!.id! : 0,
orderId: widget.orderId);
}
);
@@ -329,7 +329,7 @@ class MobileNewCommentState extends State<MobileNewComment> {
}
},
queryParameters: {
'comment_id': comment != null ? comment.id! : 0,
'comment_id': comment != null ? comment!.id! : 0,
},
).catchError((error) {
Utils.showMessageDialog(context, error);
@@ -356,7 +356,7 @@ class MobileNewCommentState extends State<MobileNewComment> {
isFormData: true,
body: {
'order_id': widget.orderId,
'comment_id': comment != null ? comment.id! : 0,
'comment_id': comment != null ? comment!.id! : 0,
'content': commentController.text,
'rating': rating.round(),
},