updateProgress static method
Update progress for a URL.
Implementation
static Future<void> updateProgress(
String url, {
required int downloadedBytes,
int? totalBytes,
bool isHls = false,
}) async {
await _ensureLoaded();
final isComplete = totalBytes != null && downloadedBytes >= totalBytes;
_cache[url] = CacheMetadata(
downloadedBytes: downloadedBytes,
totalBytes: totalBytes,
isComplete: isComplete,
lastUpdated: DateTime.now(),
isHls: isHls,
);
// Persist only on completion to reduce I/O
if (isComplete) {
await _persist();
}
}