getSortedPurchases method
Implementation
List<ProductDetails> getSortedPurchases(BuildContext context) {
List subs = context
.read<AdBase>()
.data!['subscription_config'];
subs.sort(
(a, b) => a['index'].toString().compareTo(b['index'].toString()),
);
List<ProductDetails> p = [
...subs.map((e) {
List t = products.where((element) => element.id == e['id']).toList();
return t.isEmpty ? null : t[0];
}),
];
return p;
}