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:
@@ -4,9 +4,9 @@ import 'dart:convert';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class ShippingRate {
|
||||
String name;
|
||||
double price;
|
||||
List<Rate> rates;
|
||||
String? name;
|
||||
double? price;
|
||||
List<Rate>? rates;
|
||||
|
||||
ShippingRate.fromJson(Map<String, dynamic> json)
|
||||
: name = json['name'],
|
||||
@@ -25,7 +25,7 @@ class ShippingRate {
|
||||
other is ShippingRate &&
|
||||
runtimeType == other.runtimeType &&
|
||||
name == other.name &&
|
||||
price.toStringAsFixed(2) == other.price.toStringAsFixed(2) &&
|
||||
price?.toStringAsFixed(2) == other.price?.toStringAsFixed(2) &&
|
||||
listEquals(rates, other.rates);
|
||||
|
||||
@override
|
||||
@@ -41,8 +41,8 @@ class ShippingRate {
|
||||
}
|
||||
|
||||
class Rate {
|
||||
String name;
|
||||
double rate;
|
||||
String? name;
|
||||
double? rate;
|
||||
|
||||
Rate.fromJson(Map<String, dynamic> json)
|
||||
: name = json['name'],
|
||||
@@ -59,7 +59,7 @@ class Rate {
|
||||
other is Rate &&
|
||||
runtimeType == other.runtimeType &&
|
||||
name == other.name &&
|
||||
rate.toStringAsFixed(2) == other.rate.toStringAsFixed(2);
|
||||
rate?.toStringAsFixed(2) == other.rate?.toStringAsFixed(2);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
||||
Reference in New Issue
Block a user