Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix removeCacheFile #469

Merged
merged 2 commits into from
Oct 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions flutter_cache_manager/lib/src/cache_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:async';
import 'dart:io';

import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'dart:io' as io;

///Flutter Cache Manager
///Copyright (c) 2019 Rene Floor
Expand Down Expand Up @@ -184,7 +183,7 @@ class CacheStore {
if (_futureCache.containsKey(cacheObject.key)) {
await _futureCache.remove(cacheObject.key);
}
final file = io.File(cacheObject.relativePath);
final file = await fileSystem.createFile(cacheObject.relativePath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is correct. The old code only creates a reference to the file, and this code actually creates the file. So the check for the file will always be true, which is not correct.

Might there be a problem in your own code?

Copy link

@snoopdoggy322 snoopdoggy322 Sep 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martijn00
But the file reference leads to old code that never points to the actual file, resulting in a constant accumulation of files in the cache.

Is there a possible mistake in the name of the method itself? For example, the _fileExists method uses the same fileSystem.createFile to check for the existence of a file.


if (file.existsSync()) {
try {
Expand Down