Update download_provider.dart

Move the getDirectory() call out of the for loop to enhance performance.
This commit is contained in:
NBA2K1 2025-04-29 18:18:40 +02:00
parent b6ff9fe141
commit 46526c6b6b

View file

@ -240,8 +240,8 @@ Future<void> downloadChapter(
if (!cbzFileExist && itemType == ItemType.manga ||
!mp4FileExist && itemType == ItemType.anime ||
!htmlFileExist && itemType == ItemType.novel) {
final mainDirectory = (await storageProvider.getDirectory())!;
for (var index = 0; index < pageUrls.length; index++) {
final mainDirectory = (await storageProvider.getDirectory())!;
if (Platform.isAndroid) {
if (!(await File(p.join(mainDirectory.path, ".nomedia")).exists())) {
await File(p.join(mainDirectory.path, ".nomedia")).create();