phase3(foundation): http_util dio5 migration + null-safe models

- http_util.dart: dio4->5 (DioException, nullable params, drop unused statusCode,
  null-safe e.response!.data), countryCode ?? ''
- models/* (39 files): make all instance fields nullable (fromJson initializer-list
  pattern forces nullable); fix internal method usages (cart_info/cart_line_item/
  order/shipping_rate) with !/??
- models/ now passes dart analyze with 0 errors

Widget-level null-safety + remaining utils/store continue in next batch.
This commit is contained in:
2026-07-24 03:45:01 +08:00
parent 1a578c925d
commit 4f9aa4f683
40 changed files with 382 additions and 389 deletions

View File

@@ -6,15 +6,15 @@ import 'package:uuid/uuid.dart';
import 'product.dart';
class CartLineItem {
int id;
double unitPrice;
double totalPrice;
Product product;
String name;
String description;
double quantity;
String uuid;
String parentUuid;
int? id;
double? unitPrice;
double? totalPrice;
Product? product;
String? name;
String? description;
double? quantity;
String? uuid;
String? parentUuid;
CartLineItem() {
uuid = Uuid().v4();
@@ -48,7 +48,7 @@ class CartLineItem {
}
double getTotalPrice() {
totalPrice = unitPrice * quantity;
return totalPrice;
totalPrice = (unitPrice ?? 0.0) * (quantity ?? 0);
return totalPrice ?? 0.0;
}
}