add auth, format
This commit is contained in:
@@ -31,9 +31,7 @@ class PointsHistoryLocalDataSource {
|
||||
/// Get all points entries
|
||||
Future<List<LoyaltyPointEntryModel>> getAllEntries() async {
|
||||
final box = await entriesBox;
|
||||
final entries = box.values
|
||||
.whereType<LoyaltyPointEntryModel>()
|
||||
.toList();
|
||||
final entries = box.values.whereType<LoyaltyPointEntryModel>().toList();
|
||||
entries.sort((a, b) => b.timestamp.compareTo(a.timestamp)); // Newest first
|
||||
return entries;
|
||||
}
|
||||
@@ -42,9 +40,9 @@ class PointsHistoryLocalDataSource {
|
||||
Future<LoyaltyPointEntryModel?> getEntryById(String entryId) async {
|
||||
final box = await entriesBox;
|
||||
try {
|
||||
return box.values
|
||||
.whereType<LoyaltyPointEntryModel>()
|
||||
.firstWhere((entry) => entry.entryId == entryId);
|
||||
return box.values.whereType<LoyaltyPointEntryModel>().firstWhere(
|
||||
(entry) => entry.entryId == entryId,
|
||||
);
|
||||
} catch (e) {
|
||||
throw Exception('Entry not found');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user