getBookProgress method
Implementation
BookProgressModel getBookProgress(String bookId) {
var newBookProgressModel =
BookProgressModel(currentPageIndex: 0, currentChapterIndex: 0);
try {
BookProgressModel? oldBookProgressModel = isar.bookProgressModels
.where()
.filter()
.bookIdEqualTo(bookId)
.findFirstSync();
if (oldBookProgressModel != null) {
return oldBookProgressModel;
} else {
return newBookProgressModel;
}
} on Exception {
return newBookProgressModel;
}
}