Remove check

- Remove the enableAniSkipStateProvider check, because it is already being checked by the caller (anime_player_view.dart, initState() line 353).

- Change ref.watch() to ref.read() as the user cannot change its value without exiting the video player. ref.watch() is meant to be used within reactive contexts.
This commit is contained in:
NBA2K1 2025-06-30 18:01:58 +02:00
parent b1560d3eea
commit 4a986d4c15

View file

@ -193,7 +193,7 @@ class AnimeStreamController extends _$AnimeStreamController {
}) {
if (episode.isRead!) return;
if (incognitoMode) return;
final markEpisodeAsSeenType = ref.watch(markEpisodeAsSeenTypeStateProvider);
final markEpisodeAsSeenType = ref.read(markEpisodeAsSeenTypeStateProvider);
final isWatch =
totalDuration != null &&
totalDuration != Duration.zero &&
@ -249,22 +249,20 @@ class AnimeStreamController extends _$AnimeStreamController {
Function(List<Results>) result,
) async {
await Future.delayed(const Duration(milliseconds: 300));
if (ref.watch(enableAniSkipStateProvider)) {
final id = _getTrackId();
if (id != null) {
final res = await ref
.read(aniSkipProvider.notifier)
.getResult(
id,
ChapterRecognition().parseChapterNumber(
episode.manga.value!.name!,
episode.name!,
),
0,
);
result.call(res ?? []);
return res;
}
final id = _getTrackId();
if (id != null) {
final res = await ref
.read(aniSkipProvider.notifier)
.getResult(
id,
ChapterRecognition().parseChapterNumber(
episode.manga.value!.name!,
episode.name!,
),
0,
);
result.call(res ?? []);
return res;
}
return null;
}