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:
@@ -11,33 +11,33 @@ import 'fulfillment.dart';
|
||||
import 'user_position.dart';
|
||||
|
||||
class Order {
|
||||
int id;
|
||||
int userId;
|
||||
int businessId;
|
||||
Business businessInfo;
|
||||
CartInfo cartInfo;
|
||||
int status;
|
||||
double originPrice;
|
||||
double discountPrice;
|
||||
double totalPrice;
|
||||
String consignee;
|
||||
String phone;
|
||||
String address;
|
||||
Address shippingAddress;
|
||||
int payMethod;
|
||||
String remark;
|
||||
String orderNum;
|
||||
int bookedAt;
|
||||
int createdAt;
|
||||
String shippingMethod;
|
||||
int? id;
|
||||
int? userId;
|
||||
int? businessId;
|
||||
Business? businessInfo;
|
||||
CartInfo? cartInfo;
|
||||
int? status;
|
||||
double? originPrice;
|
||||
double? discountPrice;
|
||||
double? totalPrice;
|
||||
String? consignee;
|
||||
String? phone;
|
||||
String? address;
|
||||
Address? shippingAddress;
|
||||
int? payMethod;
|
||||
String? remark;
|
||||
String? orderNum;
|
||||
int? bookedAt;
|
||||
int? createdAt;
|
||||
String? shippingMethod;
|
||||
String paymentStatus; // UNPAID, PAID, PARTIALPAID
|
||||
double amountPaid;
|
||||
List<Fulfillment> fulfillments;
|
||||
String extraData;
|
||||
bool hasComment;
|
||||
double fee;
|
||||
UserPosition shipperPosition;
|
||||
DistanceInfo deliveryDistance;
|
||||
double? amountPaid;
|
||||
List<Fulfillment>? fulfillments;
|
||||
String? extraData;
|
||||
bool? hasComment;
|
||||
double? fee;
|
||||
UserPosition? shipperPosition;
|
||||
DistanceInfo? deliveryDistance;
|
||||
|
||||
Order.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
@@ -100,7 +100,7 @@ class Order {
|
||||
|
||||
double getSubtotal() {
|
||||
double subtotal = 0.0;
|
||||
for (CartLineItem lineItem in cartInfo.productList) {
|
||||
for (CartLineItem lineItem in cartInfo?.productList ?? <CartLineItem>[]) {
|
||||
subtotal += lineItem.getTotalPrice();
|
||||
}
|
||||
return subtotal;
|
||||
|
||||
Reference in New Issue
Block a user