feat: Invalidate currently playing chapter when player position changes

This commit is contained in:
Dr-Blank 2024-05-19 09:51:06 -04:00
parent 36509913f2
commit 74dc9807d6
No known key found for this signature in database
GPG key ID: 7452CC63F210A266
2 changed files with 5 additions and 1 deletions

View file

@ -14,6 +14,10 @@ BookExpanded? currentlyPlayingBook(CurrentlyPlayingBookRef ref) {
@riverpod
BookChapter? currentPlayingChapter(CurrentPlayingChapterRef ref) {
final player = ref.watch(audiobookPlayerProvider);
player.positionStream.listen((_) {
ref.invalidateSelf();
});
return player.currentChapter;
}

View file

@ -24,7 +24,7 @@ final currentlyPlayingBookProvider =
typedef CurrentlyPlayingBookRef = AutoDisposeProviderRef<BookExpanded?>;
String _$currentPlayingChapterHash() =>
r'3a621260211cddecfd974b31d5c4820ed24b1545';
r'91ca01ee93e0d556c77237ceebb3f9281d2d2b3f';
/// provided the current chapter of the book being played
///