check null safety
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
|
||||
class Payment {
|
||||
String id;
|
||||
String invoiceID;
|
||||
DateTime paymentDate;
|
||||
String paymentReceiptURL;
|
||||
String status;
|
||||
String? id;
|
||||
String? invoiceID;
|
||||
DateTime? paymentDate;
|
||||
String? paymentReceiptURL;
|
||||
String? status;
|
||||
double amount;
|
||||
|
||||
Payment(
|
||||
@@ -14,13 +14,13 @@ class Payment {
|
||||
this.paymentDate,
|
||||
this.paymentReceiptURL,
|
||||
this.status,
|
||||
this.amount});
|
||||
this.amount = 0});
|
||||
|
||||
factory Payment.fromMap(Map<String, dynamic> map, String id) {
|
||||
var _paymentDate = (map['payment_date'] as Timestamp);
|
||||
return Payment(
|
||||
id: id,
|
||||
paymentDate: _paymentDate?.toDate(),
|
||||
paymentDate: _paymentDate.toDate(),
|
||||
paymentReceiptURL: map['payment_receipt_url'],
|
||||
status: map['status'],
|
||||
amount: map['amount']?.toDouble() ?? 0,
|
||||
@@ -31,7 +31,7 @@ class Payment {
|
||||
return {
|
||||
"id": id,
|
||||
"invoice_id": invoiceID,
|
||||
'payment_date': paymentDate?.toUtc()?.toIso8601String(),
|
||||
'payment_date': paymentDate?.toUtc().toIso8601String(),
|
||||
'payment_receipt_url': paymentReceiptURL,
|
||||
'status': status,
|
||||
'amount': amount,
|
||||
@@ -39,7 +39,7 @@ class Payment {
|
||||
}
|
||||
|
||||
Payment clone() {
|
||||
return Payment.fromMap(toMap(), this.id);
|
||||
return Payment.fromMap(toMap(), this.id!);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user