- 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.
41 lines
1008 B
Dart
41 lines
1008 B
Dart
|
|
import 'dart:convert';
|
|
|
|
import 'business.dart';
|
|
|
|
class Coupon {
|
|
int? id;
|
|
String? code;
|
|
String? description;
|
|
String? expirationDate;
|
|
double? minAmount;
|
|
Business? store;
|
|
double? valueAmount;
|
|
bool? isPercentage;
|
|
|
|
Coupon.fromJson(Map<String, dynamic> json)
|
|
: id = json['id'],
|
|
code = json['code'].toString(),
|
|
description = json['description'],
|
|
expirationDate = json['expiration_date'],
|
|
minAmount = double.parse(json['min_amount'].toString()),
|
|
store = json['store'] != null ? Business.fromJson(json['store']) : null,
|
|
valueAmount = double.parse(json['value_amount'].toString()),
|
|
isPercentage = json['is_percentage'];
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'code': code,
|
|
'description': description,
|
|
'expiration_date': expirationDate,
|
|
'min_amount': minAmount,
|
|
'store': store,
|
|
'value_amount': valueAmount,
|
|
'is_percentage': isPercentage,
|
|
};
|
|
|
|
@override
|
|
String toString() {
|
|
return json.encode(this);
|
|
}
|
|
} |