reduce memory usage

`chapters.length - chapters.reversed.toList().indexOf(chapters.reversed.toList()[finalIndex]) - 1;`
is just the same as
`chapters.length - 1 - finalIndex`
but it creates two lists, which is wasteful.
This commit is contained in:
NBA2K1 2026-04-24 00:50:22 +02:00
parent 0a2c8e2649
commit 8adb8bee17

View file

@ -900,14 +900,8 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
chapterLength: chapters.length,
);
}
int reverseIndex =
chapters.length -
chapters.reversed.toList().indexOf(
chapters.reversed.toList()[finalIndex],
) -
1;
final indexx = reverse
? reverseIndex
? (chapters.length - 1 - finalIndex)
: finalIndex;
return ChapterListTileWidget(
chapter: chapters[indexx],