findLastSubscription method

dynamic findLastSubscription()

Implementation

findLastSubscription() {
  List buffer = List.from(userPurchases.toList());
  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);
  });
  userPurchaseSortedList = buffer;
  notifyListeners();
}