check null safety

This commit is contained in:
tzw
2021-09-10 14:27:38 +06:30
parent a144c945b6
commit 7670779b03
57 changed files with 620 additions and 626 deletions

View File

@@ -5,35 +5,35 @@ import 'package:fcs/domain/vo/delivery_address.dart';
import 'package:fcs/domain/vo/shipment_status.dart';
class Package {
String id;
String trackingID;
String userID;
String fcsID;
String userName;
String phoneNumber;
DateTime currentStatusDate;
String? id;
String? trackingID;
String? userID;
String? fcsID;
String? userName;
String? phoneNumber;
DateTime? currentStatusDate;
List<String> photoUrls;
List<ShipmentStatus> shipmentHistory;
String desc;
String? desc;
String status;
String shipmentNumber;
String senderFCSID;
String senderName;
String senderPhoneNumber;
String boxNumber;
String cargoDesc;
String market;
String? status;
String? shipmentNumber;
String? senderFCSID;
String? senderName;
String? senderPhoneNumber;
String? boxNumber;
String? cargoDesc;
String? market;
bool isChecked;
int rate;
int weight;
String packageType;
String pickUpID;
List<String> photos;
String remark;
DateTime arrivedDate;
DeliveryAddress deliveryAddress;
String? packageType;
String? pickUpID;
// List<String> photos;
String? remark;
DateTime? arrivedDate;
DeliveryAddress? deliveryAddress;
//for packages in processing
List<File> photoFiles;
@@ -42,35 +42,34 @@ class Package {
double get price => rate.toDouble() * weight;
Package({
this.id,
this.trackingID,
this.userID,
this.userName,
this.fcsID,
this.phoneNumber,
this.shipmentNumber,
this.senderFCSID,
this.senderName,
this.boxNumber,
this.rate,
this.weight,
this.packageType,
this.pickUpID,
this.remark,
this.status,
this.arrivedDate,
this.cargoDesc,
this.market,
this.shipmentHistory,
this.currentStatusDate,
this.photoUrls,
this.desc,
this.deliveryAddress,
this.isChecked = false,
this.photoFiles,
this.senderPhoneNumber
});
Package(
{this.id,
this.trackingID,
this.userID,
this.userName,
this.fcsID,
this.phoneNumber,
this.shipmentNumber,
this.senderFCSID,
this.senderName,
this.boxNumber,
this.rate = 0,
this.weight = 0,
this.packageType,
this.pickUpID,
this.remark,
this.status,
this.arrivedDate,
this.cargoDesc,
this.market,
this.shipmentHistory = const [],
this.currentStatusDate,
this.photoUrls = const [],
this.desc,
this.deliveryAddress,
this.isChecked = false,
this.photoFiles = const [],
this.senderPhoneNumber});
factory Package.fromMap(Map<String, dynamic> map, String docID) {
var _currentStatusDate = (map['status_date'] as Timestamp);
@@ -98,9 +97,7 @@ class Package {
senderName: map['sender_name'],
senderPhoneNumber: map['sender_phone_number'],
deliveryAddress: _da,
currentStatusDate: _currentStatusDate != null
? _currentStatusDate.toDate().toLocal()
: null,
currentStatusDate: _currentStatusDate.toDate().toLocal(),
photoUrls: _photoUrls,
shipmentHistory: _shipmentStatus);
}