sortPurchases method
Implementation
List<PurchaseDetails> sortPurchases(List<PurchaseDetails> purchaseData) {
List<PurchaseDetails> buffer = List.from(purchaseData);
buffer.sort((a, b) {
DateTime aDate = DateTime.fromMillisecondsSinceEpoch(
int.parse(b.transactionDate ?? "0"));
DateTime bDate = DateTime.fromMillisecondsSinceEpoch(
int.parse(a.transactionDate ?? "0"));
return aDate.compareTo(bDate);
});
return buffer;
}