fetchSyncHistory method
Implementation
Future<AudioBookSyncHistory?> fetchSyncHistory() async {
try {
final resultList = await pb.collection('audiobooks_sync_history').getList(
page: 1,
perPage: 1,
sort: '-created',
);
if (resultList.items.isEmpty) {
return AudioBookSyncHistory(
totalPages: 0,
created: DateTime.fromMillisecondsSinceEpoch(0),
);
}
return AudioBookSyncHistory.fromJson(resultList.items.first.data);
} catch (e) {
return null;
}
}