- 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.
110 lines
2.1 KiB
Dart
110 lines
2.1 KiB
Dart
|
|
import 'dart:convert';
|
|
|
|
import 'simple_business.dart';
|
|
|
|
class TicketFile {
|
|
int? id;
|
|
String? url;
|
|
String? fileName;
|
|
String? fileType;
|
|
|
|
TicketFile.fromJson(Map<String, dynamic> json)
|
|
: id = json['id'],
|
|
url = json['url'],
|
|
fileName = json['file_name'],
|
|
fileType = json['file_type'];
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'url': url,
|
|
'file_name': fileName,
|
|
'file_type': fileType,
|
|
};
|
|
|
|
@override
|
|
String toString() {
|
|
return json.encode(this);
|
|
}
|
|
}
|
|
|
|
class Issue {
|
|
int? id;
|
|
String? msg;
|
|
List<TicketFile>? files;
|
|
|
|
Issue.fromJson(Map<String, dynamic> json)
|
|
: id = json['id'],
|
|
msg = json['msg'],
|
|
files = (json['files'] as List).map((e) => TicketFile.fromJson(e)).toList();
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'msg': msg,
|
|
'files': files,
|
|
};
|
|
|
|
@override
|
|
String toString() {
|
|
return json.encode(this);
|
|
}
|
|
}
|
|
|
|
class FollowUp {
|
|
int? id;
|
|
String? msg;
|
|
String? poster;
|
|
String? createdAt;
|
|
List<TicketFile>? files;
|
|
|
|
FollowUp.fromJson(Map<String, dynamic> json)
|
|
: id = json['id'],
|
|
msg = json['msg'],
|
|
poster = json['poster'],
|
|
createdAt = json['created_at'],
|
|
files = (json['files'] as List).map((e) => TicketFile.fromJson(e)).toList();
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'msg': msg,
|
|
'poster': poster,
|
|
'created_at': createdAt,
|
|
'files': files
|
|
};
|
|
|
|
@override
|
|
String toString() {
|
|
return json.encode(this);
|
|
}
|
|
}
|
|
|
|
class Ticket {
|
|
int? id;
|
|
Issue? issue;
|
|
Store? store;
|
|
List<FollowUp>? followUps;
|
|
bool? isClosed;
|
|
String? createdAt;
|
|
|
|
Ticket.fromJson(Map<String, dynamic> json)
|
|
: id = json['id'],
|
|
issue = Issue.fromJson(json['issue']),
|
|
store = Store.fromJson(json['store']),
|
|
followUps = (json['follow_ups'] as List).map((e) => FollowUp.fromJson(e)).toList(),
|
|
isClosed = json['is_closed'],
|
|
createdAt = json['created_at'];
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'issue': issue,
|
|
'store': store,
|
|
'follow_ups': followUps,
|
|
'is_closed': isClosed,
|
|
'created_at': createdAt,
|
|
};
|
|
|
|
@override
|
|
String toString() {
|
|
return json.encode(this);
|
|
}
|
|
} |