diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 00000000..e0f15db2
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "java.configuration.updateBuildConfiguration": "automatic"
+}
\ No newline at end of file
diff --git a/README.md b/README.md
deleted file mode 100644
index ed54c7ad..00000000
--- a/README.md
+++ /dev/null
@@ -1,106 +0,0 @@
-BREAKING CHANGES IN V2
-
-CacheManager v2 introduced some breaking changes when configuring a custom CacheManager. [See the bottom of this page
- for the changes.](#breaking-changes-in-v2)
-
-# flutter_cache_manager
-
-[](https://pub.dartlang.org/packages/flutter_cache_manager)
-[](https://app.bitrise.io/app/b3454de795b5c22a)
-[](https://codecov.io/gh/Baseflow/flutter_cache_manager)
-
-A CacheManager to download and cache files in the cache directory of the app. Various settings on how long to keep a file can be changed.
-
-It uses the cache-control http header to efficiently retrieve files.
-
-The more basic usage is explained here. See the complete docs for more info.
-
-
-## Usage
-
-The cache manager can be used to get a file on various ways
-The easiest way to get a single file is call `.getSingleFile`.
-
-```
- var file = await DefaultCacheManager().getSingleFile(url);
-```
-`getFileStream(url)` returns a stream with the first result being the cached file and later optionally the downloaded file.
-
-`getFileStream(url, withProgress: true)` when you set withProgress on true, this stream will also emit DownloadProgress when the file is not found in the cache.
-
-`downloadFile(url)` directly downloads from the web.
-
-`getFileFromCache` only retrieves from cache and returns no file when the file is not in the cache.
-
-
-`putFile` gives the option to put a new file into the cache without downloading it.
-
-`removeFile` removes a file from the cache.
-
-`emptyCache` removes all files from the cache.
-
-## Other implementations
-When your files are stored on Firebase Storage you can use [flutter_cache_manager_firebase](https://pub.dev/packages/flutter_cache_manager_firebase).
-
-## Customize
-The cache manager is customizable by creating a new CacheManager. It is very important to not create more than 1
- CacheManager instance with the same key as these bite each other. In the example down here the manager is created as a
- Singleton, but you could also use for example Provider to Provide a CacheManager on the top level of your app.
-Below is an example with other settings for the maximum age of files, maximum number of objects
-and a custom FileService. The key parameter in the constructor is mandatory, all other variables are optional.
-
-```
-class CustomCacheManager {
- static const key = 'customCacheKey';
- static CacheManager instance = CacheManager(
- Config(
- key,
- stalePeriod: const Duration(days: 7),
- maxNrOfCacheObjects: 20,
- repo: JsonCacheInfoRepository(databaseName: key),
- fileSystem: IOFileSystem(key),
- fileService: HttpFileService(),
- ),
- );
-}
-```
-## Frequently Asked Questions
-- [How are the cache files stored?](#how-are-the-cache-files-stored)
-- [When are the cached files updated?](#when-are-the-cached-files-updated)
-- [When are cached files removed?](#when-are-cached-files-removed)
-
-
-### How are the cache files stored?
-By default the cached files are stored in the temporary directory of the app. This means the OS can delete the files any time.
-
-Information about the files is stored in a database using sqflite on Android, iOS and macOs, or in a plain JSON file
- on other platforms. The file name of the database is the key of the cacheManager, that's why that has to be unique.
-
-### When are the cached files updated?
-A valid url response should contain a Cache-Control header. More info on the header can be found
-[here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control), but in summary it says for how long
-the image can be expected to be up to date. It also contains an 'eTag' which can be used to check (after that time)
-whether the file did change or if it is actually still valid.
-
-When a file is in the cache that is always directly returned when calling `getSingleFile` or `getFileStream`.
-After that the information is check if the file is actually still valid. If the file is outdated according to the
-Cache-Control headers the manager tries to update the file and store the new one in the cache. When you use
-`getFileStream` this updated file will also be returned in the stream.
-
-### When are cached files removed?
-The files can be removed by the cache manager or by the operating system. By default the files are stored in a cache
- folder, which is sometimes cleaned for example on Android with an app update.
-
-The cache manager uses 2 variables to determine when to delete a file, the `maxNrOfCacheObjects` and the `stalePeriod`.
-The cache knows when files have been used latest. When cleaning the cache (which happens continuously), the cache
-deletes files when there are too many, ordered by last use, and when files just haven't been used for longer than
-the stale period.
-
-
-## Breaking changes in v2
-- There is no longer a need to extend on BaseCacheManager, you can directly call the constructor. The BaseCacheManager
- is therefore renamed to CacheManager as it is not really just a 'base' anymore.
-
-- The constructor now expects a Config object with some settings you were used to, but some are slightly different.
-For example the system where you want to store your files is not just a dictionary anymore, but a FileSystem. That way
-you have more freedom on where to store your files.
diff --git a/README.md b/README.md
new file mode 120000
index 00000000..53a16f37
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+flutter_cache_manager/README.md
\ No newline at end of file
diff --git a/flutter_cache_manager/README.md b/flutter_cache_manager/README.md
index 8ea4e19e..3c5b77e4 100644
--- a/flutter_cache_manager/README.md
+++ b/flutter_cache_manager/README.md
@@ -21,8 +21,8 @@ The more basic usage is explained here. See the complete docs for more info.
The cache manager can be used to get a file on various ways
The easiest way to get a single file is call `.getSingleFile`.
-```
- var file = await DefaultCacheManager().getSingleFile(url);
+```dart
+var file = await DefaultCacheManager().getSingleFile(url);
```
`getFileStream(url)` returns a stream with the first result being the cached file and later optionally the downloaded file.
@@ -43,7 +43,7 @@ The easiest way to get a single file is call `.getSingleFile`.
If you use the ImageCacheManager mixin on the CacheManager (which is already done on the DefaultCacheManager) you
get the following `getImageFile` method for free:
-```
+```dart
Stream getImageFile(String url, {
String key,
Map headers,
@@ -66,7 +66,7 @@ The cache manager is customizable by creating a new CacheManager. It is very imp
Below is an example with other settings for the maximum age of files, maximum number of objects
and a custom FileService. The key parameter in the constructor is mandatory, all other variables are optional.
-```
+```dart
class CustomCacheManager {
static const key = 'customCacheKey';
static CacheManager instance = CacheManager(
diff --git a/flutter_cache_manager/example/.gitignore b/flutter_cache_manager/example/.gitignore
index 24476c5d..79c113f9 100644
--- a/flutter_cache_manager/example/.gitignore
+++ b/flutter_cache_manager/example/.gitignore
@@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
+.build/
.buildlog/
.history
.svn/
+.swiftpm/
migrate_working_dir/
# IntelliJ related
@@ -27,7 +29,6 @@ migrate_working_dir/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
-.packages
.pub-cache/
.pub/
/build/
diff --git a/flutter_cache_manager/example/.metadata b/flutter_cache_manager/example/.metadata
index 8a0ce793..9a674c61 100644
--- a/flutter_cache_manager/example/.metadata
+++ b/flutter_cache_manager/example/.metadata
@@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.
version:
- revision: "b0850beeb25f6d5b10426284f506557f66181b36"
+ revision: "35c388afb57ef061d06a39b537336c87e0e3d1b1"
channel: "stable"
project_type: app
@@ -13,23 +13,26 @@ project_type: app
migration:
platforms:
- platform: root
- create_revision: b0850beeb25f6d5b10426284f506557f66181b36
- base_revision: b0850beeb25f6d5b10426284f506557f66181b36
+ create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
+ base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
- platform: android
- create_revision: b0850beeb25f6d5b10426284f506557f66181b36
- base_revision: b0850beeb25f6d5b10426284f506557f66181b36
+ create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
+ base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
- platform: ios
- create_revision: b0850beeb25f6d5b10426284f506557f66181b36
- base_revision: b0850beeb25f6d5b10426284f506557f66181b36
+ create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
+ base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
+ - platform: linux
+ create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
+ base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
- platform: macos
- create_revision: b0850beeb25f6d5b10426284f506557f66181b36
- base_revision: b0850beeb25f6d5b10426284f506557f66181b36
+ create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
+ base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
- platform: web
- create_revision: b0850beeb25f6d5b10426284f506557f66181b36
- base_revision: b0850beeb25f6d5b10426284f506557f66181b36
+ create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
+ base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
- platform: windows
- create_revision: b0850beeb25f6d5b10426284f506557f66181b36
- base_revision: b0850beeb25f6d5b10426284f506557f66181b36
+ create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
+ base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
# User provided section
diff --git a/flutter_cache_manager/example/README.md b/flutter_cache_manager/example/README.md
index 75a7c517..2b3fce4c 100644
--- a/flutter_cache_manager/example/README.md
+++ b/flutter_cache_manager/example/README.md
@@ -1 +1,16 @@
-# A project that showcases usage of flutter_cache_manager
+# example
+
+A new Flutter project.
+
+## Getting Started
+
+This project is a starting point for a Flutter application.
+
+A few resources to get you started if this is your first Flutter project:
+
+- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
+- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
+
+For help getting started with Flutter development, view the
+[online documentation](https://docs.flutter.dev/), which offers tutorials,
+samples, guidance on mobile development, and a full API reference.
diff --git a/flutter_cache_manager/example/analysis_options.yaml b/flutter_cache_manager/example/analysis_options.yaml
index f9b30346..0d290213 100644
--- a/flutter_cache_manager/example/analysis_options.yaml
+++ b/flutter_cache_manager/example/analysis_options.yaml
@@ -1 +1,28 @@
+# This file configures the analyzer, which statically analyzes Dart code to
+# check for errors, warnings, and lints.
+#
+# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
+# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
+# invoked from the command line by running `flutter analyze`.
+
+# The following line activates a set of recommended lints for Flutter apps,
+# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
+
+linter:
+ # The lint rules applied to this project can be customized in the
+ # section below to disable rules from the `package:flutter_lints/flutter.yaml`
+ # included above or to enable additional rules. A list of all available lints
+ # and their documentation is published at https://dart.dev/lints.
+ #
+ # Instead of disabling a lint rule for the entire project in the
+ # section below, it can also be suppressed for a single line of code
+ # or a specific dart file by using the `// ignore: name_of_lint` and
+ # `// ignore_for_file: name_of_lint` syntax on the line or in the file
+ # producing the lint.
+ rules:
+ # avoid_print: false # Uncomment to disable the `avoid_print` rule
+ # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
+
+# Additional information about this file can be found at
+# https://dart.dev/guides/language/analysis-options
diff --git a/flutter_cache_manager/example/android/.gitignore b/flutter_cache_manager/example/android/.gitignore
index 6f568019..be3943c9 100644
--- a/flutter_cache_manager/example/android/.gitignore
+++ b/flutter_cache_manager/example/android/.gitignore
@@ -5,9 +5,10 @@ gradle-wrapper.jar
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
+.cxx/
# Remember to never publicly share your keystore.
-# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
+# See https://flutter.dev/to/reference-keystore
key.properties
**/*.keystore
**/*.jks
diff --git a/flutter_cache_manager/example/android/app/build.gradle b/flutter_cache_manager/example/android/app/build.gradle
deleted file mode 100644
index 2a2d082b..00000000
--- a/flutter_cache_manager/example/android/app/build.gradle
+++ /dev/null
@@ -1,58 +0,0 @@
-plugins {
- id "com.android.application"
- id "kotlin-android"
- // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
- id "dev.flutter.flutter-gradle-plugin"
-}
-
-def localProperties = new Properties()
-def localPropertiesFile = rootProject.file("local.properties")
-if (localPropertiesFile.exists()) {
- localPropertiesFile.withReader("UTF-8") { reader ->
- localProperties.load(reader)
- }
-}
-
-def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
-if (flutterVersionCode == null) {
- flutterVersionCode = "1"
-}
-
-def flutterVersionName = localProperties.getProperty("flutter.versionName")
-if (flutterVersionName == null) {
- flutterVersionName = "1.0"
-}
-
-android {
- namespace = "com.example.example"
- compileSdk = flutter.compileSdkVersion
- ndkVersion = flutter.ndkVersion
-
- compileOptions {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
- }
-
- defaultConfig {
- // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
- applicationId = "com.example.example"
- // You can update the following values to match your application needs.
- // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
- minSdk = flutter.minSdkVersion
- targetSdk = flutter.targetSdkVersion
- versionCode = flutterVersionCode.toInteger()
- versionName = flutterVersionName
- }
-
- buildTypes {
- release {
- // TODO: Add your own signing config for the release build.
- // Signing with the debug keys for now, so `flutter run --release` works.
- signingConfig = signingConfigs.debug
- }
- }
-}
-
-flutter {
- source = "../.."
-}
diff --git a/flutter_cache_manager/example/android/app/build.gradle.kts b/flutter_cache_manager/example/android/app/build.gradle.kts
new file mode 100644
index 00000000..d77dd1aa
--- /dev/null
+++ b/flutter_cache_manager/example/android/app/build.gradle.kts
@@ -0,0 +1,44 @@
+plugins {
+ id("com.android.application")
+ id("kotlin-android")
+ // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
+ id("dev.flutter.flutter-gradle-plugin")
+}
+
+android {
+ namespace = "com.example.example"
+ compileSdk = flutter.compileSdkVersion
+ ndkVersion = "27.0.12077973"
+
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_11
+ targetCompatibility = JavaVersion.VERSION_11
+ }
+
+ kotlinOptions {
+ jvmTarget = JavaVersion.VERSION_11.toString()
+ }
+
+ defaultConfig {
+ // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
+ applicationId = "com.example.example"
+ // You can update the following values to match your application needs.
+ // For more information, see: https://flutter.dev/to/review-gradle-config.
+ minSdk = flutter.minSdkVersion
+ targetSdk = flutter.targetSdkVersion
+ versionCode = flutter.versionCode
+ versionName = flutter.versionName
+ }
+
+ buildTypes {
+ release {
+ // TODO: Add your own signing config for the release build.
+ // Signing with the debug keys for now, so `flutter run --release` works.
+ signingConfig = signingConfigs.getByName("debug")
+ }
+ }
+}
+
+flutter {
+ source = "../.."
+}
diff --git a/flutter_cache_manager/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/flutter_cache_manager/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt
index 70f8f08f..ac81bae6 100644
--- a/flutter_cache_manager/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt
+++ b/flutter_cache_manager/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt
@@ -2,4 +2,4 @@ package com.example.example
import io.flutter.embedding.android.FlutterActivity
-class MainActivity: FlutterActivity()
+class MainActivity : FlutterActivity()
diff --git a/flutter_cache_manager/example/android/build.gradle b/flutter_cache_manager/example/android/build.gradle
deleted file mode 100644
index d2ffbffa..00000000
--- a/flutter_cache_manager/example/android/build.gradle
+++ /dev/null
@@ -1,18 +0,0 @@
-allprojects {
- repositories {
- google()
- mavenCentral()
- }
-}
-
-rootProject.buildDir = "../build"
-subprojects {
- project.buildDir = "${rootProject.buildDir}/${project.name}"
-}
-subprojects {
- project.evaluationDependsOn(":app")
-}
-
-tasks.register("clean", Delete) {
- delete rootProject.buildDir
-}
diff --git a/flutter_cache_manager/example/android/build.gradle.kts b/flutter_cache_manager/example/android/build.gradle.kts
new file mode 100644
index 00000000..89176ef4
--- /dev/null
+++ b/flutter_cache_manager/example/android/build.gradle.kts
@@ -0,0 +1,21 @@
+allprojects {
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
+rootProject.layout.buildDirectory.value(newBuildDir)
+
+subprojects {
+ val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
+ project.layout.buildDirectory.value(newSubprojectBuildDir)
+}
+subprojects {
+ project.evaluationDependsOn(":app")
+}
+
+tasks.register("clean") {
+ delete(rootProject.layout.buildDirectory)
+}
diff --git a/flutter_cache_manager/example/android/gradle.properties b/flutter_cache_manager/example/android/gradle.properties
index 3b5b324f..f018a618 100644
--- a/flutter_cache_manager/example/android/gradle.properties
+++ b/flutter_cache_manager/example/android/gradle.properties
@@ -1,3 +1,3 @@
-org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
+org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
diff --git a/flutter_cache_manager/example/android/gradle/wrapper/gradle-wrapper.properties b/flutter_cache_manager/example/android/gradle/wrapper/gradle-wrapper.properties
index e1ca574e..afa1e8eb 100644
--- a/flutter_cache_manager/example/android/gradle/wrapper/gradle-wrapper.properties
+++ b/flutter_cache_manager/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
diff --git a/flutter_cache_manager/example/android/settings.gradle b/flutter_cache_manager/example/android/settings.gradle
deleted file mode 100644
index 536165d3..00000000
--- a/flutter_cache_manager/example/android/settings.gradle
+++ /dev/null
@@ -1,25 +0,0 @@
-pluginManagement {
- def flutterSdkPath = {
- def properties = new Properties()
- file("local.properties").withInputStream { properties.load(it) }
- def flutterSdkPath = properties.getProperty("flutter.sdk")
- assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
- return flutterSdkPath
- }()
-
- includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
-
- repositories {
- google()
- mavenCentral()
- gradlePluginPortal()
- }
-}
-
-plugins {
- id "dev.flutter.flutter-plugin-loader" version "1.0.0"
- id "com.android.application" version "7.3.0" apply false
- id "org.jetbrains.kotlin.android" version "1.7.10" apply false
-}
-
-include ":app"
diff --git a/flutter_cache_manager/example/android/settings.gradle.kts b/flutter_cache_manager/example/android/settings.gradle.kts
new file mode 100644
index 00000000..a439442c
--- /dev/null
+++ b/flutter_cache_manager/example/android/settings.gradle.kts
@@ -0,0 +1,25 @@
+pluginManagement {
+ val flutterSdkPath = run {
+ val properties = java.util.Properties()
+ file("local.properties").inputStream().use { properties.load(it) }
+ val flutterSdkPath = properties.getProperty("flutter.sdk")
+ require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
+ flutterSdkPath
+ }
+
+ includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
+
+ repositories {
+ google()
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
+
+plugins {
+ id("dev.flutter.flutter-plugin-loader") version "1.0.0"
+ id("com.android.application") version "8.7.0" apply false
+ id("org.jetbrains.kotlin.android") version "1.8.22" apply false
+}
+
+include(":app")
diff --git a/flutter_cache_manager/example/ios/Flutter/Debug.xcconfig b/flutter_cache_manager/example/ios/Flutter/Debug.xcconfig
index ec97fc6f..592ceee8 100644
--- a/flutter_cache_manager/example/ios/Flutter/Debug.xcconfig
+++ b/flutter_cache_manager/example/ios/Flutter/Debug.xcconfig
@@ -1,2 +1 @@
-#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
diff --git a/flutter_cache_manager/example/ios/Flutter/Release.xcconfig b/flutter_cache_manager/example/ios/Flutter/Release.xcconfig
index c4855bfe..592ceee8 100644
--- a/flutter_cache_manager/example/ios/Flutter/Release.xcconfig
+++ b/flutter_cache_manager/example/ios/Flutter/Release.xcconfig
@@ -1,2 +1 @@
-#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
diff --git a/flutter_cache_manager/example/ios/Podfile b/flutter_cache_manager/example/ios/Podfile
deleted file mode 100644
index d97f17e2..00000000
--- a/flutter_cache_manager/example/ios/Podfile
+++ /dev/null
@@ -1,44 +0,0 @@
-# Uncomment this line to define a global platform for your project
-# platform :ios, '12.0'
-
-# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
-ENV['COCOAPODS_DISABLE_STATS'] = 'true'
-
-project 'Runner', {
- 'Debug' => :debug,
- 'Profile' => :release,
- 'Release' => :release,
-}
-
-def flutter_root
- generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
- unless File.exist?(generated_xcode_build_settings_path)
- raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
- end
-
- File.foreach(generated_xcode_build_settings_path) do |line|
- matches = line.match(/FLUTTER_ROOT\=(.*)/)
- return matches[1].strip if matches
- end
- raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
-end
-
-require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
-
-flutter_ios_podfile_setup
-
-target 'Runner' do
- use_frameworks!
- use_modular_headers!
-
- flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
- target 'RunnerTests' do
- inherit! :search_paths
- end
-end
-
-post_install do |installer|
- installer.pods_project.targets.each do |target|
- flutter_additional_ios_build_settings(target)
- end
-end
diff --git a/flutter_cache_manager/example/ios/Runner.xcodeproj/project.pbxproj b/flutter_cache_manager/example/ios/Runner.xcodeproj/project.pbxproj
index 506236fe..ce3bc8fc 100644
--- a/flutter_cache_manager/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/flutter_cache_manager/example/ios/Runner.xcodeproj/project.pbxproj
@@ -362,7 +362,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
- DEVELOPMENT_TEAM = 6UEL98K25V;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
@@ -542,7 +541,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
- DEVELOPMENT_TEAM = 6UEL98K25V;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
@@ -565,7 +563,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
- DEVELOPMENT_TEAM = 6UEL98K25V;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
diff --git a/flutter_cache_manager/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/flutter_cache_manager/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index 8e3ca5df..15cada48 100644
--- a/flutter_cache_manager/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/flutter_cache_manager/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -59,6 +59,7 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
+ enableGPUValidationMode = "1"
allowLocationSimulation = "YES">
diff --git a/flutter_cache_manager/example/ios/Runner/AppDelegate.swift b/flutter_cache_manager/example/ios/Runner/AppDelegate.swift
index 9074fee9..62666446 100644
--- a/flutter_cache_manager/example/ios/Runner/AppDelegate.swift
+++ b/flutter_cache_manager/example/ios/Runner/AppDelegate.swift
@@ -1,7 +1,7 @@
import Flutter
import UIKit
-@UIApplicationMain
+@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
diff --git a/flutter_cache_manager/example/linux/CMakeLists.txt b/flutter_cache_manager/example/linux/CMakeLists.txt
index be8ea20c..7a9a314f 100644
--- a/flutter_cache_manager/example/linux/CMakeLists.txt
+++ b/flutter_cache_manager/example/linux/CMakeLists.txt
@@ -1,5 +1,5 @@
# Project-level configuration.
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.13)
project(runner LANGUAGES CXX)
# The name of the executable created for the application. Change this to change
@@ -7,7 +7,7 @@ project(runner LANGUAGES CXX)
set(BINARY_NAME "example")
# The unique GTK application identifier for this application. See:
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
-set(APPLICATION_ID "com.baseflow.example")
+set(APPLICATION_ID "com.example.example")
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.
@@ -54,25 +54,8 @@ add_subdirectory(${FLUTTER_MANAGED_DIR})
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
-add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
-
-# Define the application target. To change its name, change BINARY_NAME above,
-# not the value here, or `flutter run` will no longer work.
-#
-# Any new source files that you add to the application should be added here.
-add_executable(${BINARY_NAME}
- "main.cc"
- "my_application.cc"
- "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
-)
-
-# Apply the standard set of build settings. This can be removed for applications
-# that need different build settings.
-apply_standard_settings(${BINARY_NAME})
-
-# Add dependency libraries. Add any application-specific dependencies here.
-target_link_libraries(${BINARY_NAME} PRIVATE flutter)
-target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
+# Application build; see runner/CMakeLists.txt.
+add_subdirectory("runner")
# Run the Flutter tool portions of the build. This must not be removed.
add_dependencies(${BINARY_NAME} flutter_assemble)
@@ -123,6 +106,12 @@ foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
COMPONENT Runtime)
endforeach(bundled_library)
+# Copy the native assets provided by the build.dart from all packages.
+set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/")
+install(DIRECTORY "${NATIVE_ASSETS_DIR}"
+ DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
+ COMPONENT Runtime)
+
# Fully re-copy the assets directory on each build to avoid having stale files
# from a previous install.
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
diff --git a/flutter_cache_manager/example/linux/runner/CMakeLists.txt b/flutter_cache_manager/example/linux/runner/CMakeLists.txt
new file mode 100644
index 00000000..e97dabc7
--- /dev/null
+++ b/flutter_cache_manager/example/linux/runner/CMakeLists.txt
@@ -0,0 +1,26 @@
+cmake_minimum_required(VERSION 3.13)
+project(runner LANGUAGES CXX)
+
+# Define the application target. To change its name, change BINARY_NAME in the
+# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
+# work.
+#
+# Any new source files that you add to the application should be added here.
+add_executable(${BINARY_NAME}
+ "main.cc"
+ "my_application.cc"
+ "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
+)
+
+# Apply the standard set of build settings. This can be removed for applications
+# that need different build settings.
+apply_standard_settings(${BINARY_NAME})
+
+# Add preprocessor definitions for the application ID.
+add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
+
+# Add dependency libraries. Add any application-specific dependencies here.
+target_link_libraries(${BINARY_NAME} PRIVATE flutter)
+target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
+
+target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
diff --git a/flutter_cache_manager/example/linux/main.cc b/flutter_cache_manager/example/linux/runner/main.cc
similarity index 100%
rename from flutter_cache_manager/example/linux/main.cc
rename to flutter_cache_manager/example/linux/runner/main.cc
diff --git a/flutter_cache_manager/example/linux/my_application.cc b/flutter_cache_manager/example/linux/runner/my_application.cc
similarity index 78%
rename from flutter_cache_manager/example/linux/my_application.cc
rename to flutter_cache_manager/example/linux/runner/my_application.cc
index 0ba8f430..6c810823 100644
--- a/flutter_cache_manager/example/linux/my_application.cc
+++ b/flutter_cache_manager/example/linux/runner/my_application.cc
@@ -81,6 +81,24 @@ static gboolean my_application_local_command_line(GApplication* application, gch
return TRUE;
}
+// Implements GApplication::startup.
+static void my_application_startup(GApplication* application) {
+ //MyApplication* self = MY_APPLICATION(object);
+
+ // Perform any actions required at application startup.
+
+ G_APPLICATION_CLASS(my_application_parent_class)->startup(application);
+}
+
+// Implements GApplication::shutdown.
+static void my_application_shutdown(GApplication* application) {
+ //MyApplication* self = MY_APPLICATION(object);
+
+ // Perform any actions required at application shutdown.
+
+ G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application);
+}
+
// Implements GObject::dispose.
static void my_application_dispose(GObject* object) {
MyApplication* self = MY_APPLICATION(object);
@@ -91,12 +109,20 @@ static void my_application_dispose(GObject* object) {
static void my_application_class_init(MyApplicationClass* klass) {
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
+ G_APPLICATION_CLASS(klass)->startup = my_application_startup;
+ G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown;
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
}
static void my_application_init(MyApplication* self) {}
MyApplication* my_application_new() {
+ // Set the program name to the application ID, which helps various systems
+ // like GTK and desktop environments map this running application to its
+ // corresponding .desktop file. This ensures better integration by allowing
+ // the application to be recognized beyond its binary name.
+ g_set_prgname(APPLICATION_ID);
+
return MY_APPLICATION(g_object_new(my_application_get_type(),
"application-id", APPLICATION_ID,
"flags", G_APPLICATION_NON_UNIQUE,
diff --git a/flutter_cache_manager/example/linux/my_application.h b/flutter_cache_manager/example/linux/runner/my_application.h
similarity index 100%
rename from flutter_cache_manager/example/linux/my_application.h
rename to flutter_cache_manager/example/linux/runner/my_application.h
diff --git a/flutter_cache_manager/example/macos/Flutter/Flutter-Debug.xcconfig b/flutter_cache_manager/example/macos/Flutter/Flutter-Debug.xcconfig
index 4b81f9b2..c2efd0b6 100644
--- a/flutter_cache_manager/example/macos/Flutter/Flutter-Debug.xcconfig
+++ b/flutter_cache_manager/example/macos/Flutter/Flutter-Debug.xcconfig
@@ -1,2 +1 @@
-#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
diff --git a/flutter_cache_manager/example/macos/Flutter/Flutter-Release.xcconfig b/flutter_cache_manager/example/macos/Flutter/Flutter-Release.xcconfig
index 5caa9d15..c2efd0b6 100644
--- a/flutter_cache_manager/example/macos/Flutter/Flutter-Release.xcconfig
+++ b/flutter_cache_manager/example/macos/Flutter/Flutter-Release.xcconfig
@@ -1,2 +1 @@
-#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
diff --git a/flutter_cache_manager/example/macos/Flutter/GeneratedPluginRegistrant.swift b/flutter_cache_manager/example/macos/Flutter/GeneratedPluginRegistrant.swift
index d24127f3..645e27da 100644
--- a/flutter_cache_manager/example/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/flutter_cache_manager/example/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -5,12 +5,10 @@
import FlutterMacOS
import Foundation
-import path_provider_foundation
-import sqflite
+import sqflite_darwin
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
- PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}
diff --git a/flutter_cache_manager/example/macos/Podfile b/flutter_cache_manager/example/macos/Podfile
deleted file mode 100644
index c795730d..00000000
--- a/flutter_cache_manager/example/macos/Podfile
+++ /dev/null
@@ -1,43 +0,0 @@
-platform :osx, '10.14'
-
-# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
-ENV['COCOAPODS_DISABLE_STATS'] = 'true'
-
-project 'Runner', {
- 'Debug' => :debug,
- 'Profile' => :release,
- 'Release' => :release,
-}
-
-def flutter_root
- generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
- unless File.exist?(generated_xcode_build_settings_path)
- raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
- end
-
- File.foreach(generated_xcode_build_settings_path) do |line|
- matches = line.match(/FLUTTER_ROOT\=(.*)/)
- return matches[1].strip if matches
- end
- raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
-end
-
-require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
-
-flutter_macos_podfile_setup
-
-target 'Runner' do
- use_frameworks!
- use_modular_headers!
-
- flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
- target 'RunnerTests' do
- inherit! :search_paths
- end
-end
-
-post_install do |installer|
- installer.pods_project.targets.each do |target|
- flutter_additional_macos_build_settings(target)
- end
-end
diff --git a/flutter_cache_manager/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/flutter_cache_manager/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index 15368ecc..ac78810c 100644
--- a/flutter_cache_manager/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/flutter_cache_manager/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -59,6 +59,7 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
+ enableGPUValidationMode = "1"
allowLocationSimulation = "YES">
diff --git a/flutter_cache_manager/example/macos/Runner/AppDelegate.swift b/flutter_cache_manager/example/macos/Runner/AppDelegate.swift
index d53ef643..b3c17614 100644
--- a/flutter_cache_manager/example/macos/Runner/AppDelegate.swift
+++ b/flutter_cache_manager/example/macos/Runner/AppDelegate.swift
@@ -1,9 +1,13 @@
import Cocoa
import FlutterMacOS
-@NSApplicationMain
+@main
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}
+
+ override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
+ return true
+ }
}
diff --git a/flutter_cache_manager/example/macos/Runner/Configs/AppInfo.xcconfig b/flutter_cache_manager/example/macos/Runner/Configs/AppInfo.xcconfig
index 92fb3cd5..dda9752f 100644
--- a/flutter_cache_manager/example/macos/Runner/Configs/AppInfo.xcconfig
+++ b/flutter_cache_manager/example/macos/Runner/Configs/AppInfo.xcconfig
@@ -11,4 +11,4 @@ PRODUCT_NAME = example
PRODUCT_BUNDLE_IDENTIFIER = com.example.example
// The copyright displayed in application information
-PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved.
+PRODUCT_COPYRIGHT = Copyright © 2025 com.example. All rights reserved.
diff --git a/flutter_cache_manager/example/pubspec.yaml b/flutter_cache_manager/example/pubspec.yaml
index 5f5bcc98..952ff47d 100644
--- a/flutter_cache_manager/example/pubspec.yaml
+++ b/flutter_cache_manager/example/pubspec.yaml
@@ -1,23 +1,29 @@
name: example
-description: A project that showcases usage of flutter_cache_manager
-publish_to: none
+description: "A project that showcases usage of flutter_cache_manager"
+
+publish_to: 'none'
+
version: 1.0.0+1
+
environment:
- sdk: '>=3.0.0 <4.0.0'
+ sdk: ^3.7.0
dependencies:
baseflow_plugin_template: ^2.2.0
+
cupertino_icons: ^1.0.8
flutter:
sdk: flutter
flutter_cache_manager:
path: ../
- url_launcher: ^6.3.0
+ url_launcher: ^6.3.1
dev_dependencies:
+
+ flutter_lints: ^5.0.0
flutter_test:
sdk: flutter
- flutter_lints: ^4.0.0
flutter:
+
uses-material-design: true
diff --git a/flutter_cache_manager/example/test/widget_test.dart b/flutter_cache_manager/example/test/widget_test.dart
index 570e0e47..d289e060 100644
--- a/flutter_cache_manager/example/test/widget_test.dart
+++ b/flutter_cache_manager/example/test/widget_test.dart
@@ -1,8 +1,29 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
-// utility that Flutter provides. For example, you can send tap and scroll
+// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
-void main() {}
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+
+void main() {
+ testWidgets('Counter increments smoke test', (WidgetTester tester) async {
+ // Build our app and trigger a frame.
+ // await tester.pumpWidget(const MyApp());
+
+ // Verify that our counter starts at 0.
+ expect(find.text('0'), findsOneWidget);
+ expect(find.text('1'), findsNothing);
+
+ // Tap the '+' icon and trigger a frame.
+ await tester.tap(find.byIcon(Icons.add));
+ await tester.pump();
+
+ // Verify that our counter has incremented.
+ expect(find.text('0'), findsNothing);
+ expect(find.text('1'), findsOneWidget);
+ });
+}
diff --git a/flutter_cache_manager/example/web/index.html b/flutter_cache_manager/example/web/index.html
index 1aa025dd..29b58086 100644
--- a/flutter_cache_manager/example/web/index.html
+++ b/flutter_cache_manager/example/web/index.html
@@ -21,7 +21,7 @@
-
+
diff --git a/flutter_cache_manager/example/windows/runner/Runner.rc b/flutter_cache_manager/example/windows/runner/Runner.rc
index 687e6bd2..289fc7ee 100644
--- a/flutter_cache_manager/example/windows/runner/Runner.rc
+++ b/flutter_cache_manager/example/windows/runner/Runner.rc
@@ -93,7 +93,7 @@ BEGIN
VALUE "FileDescription", "example" "\0"
VALUE "FileVersion", VERSION_AS_STRING "\0"
VALUE "InternalName", "example" "\0"
- VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0"
+ VALUE "LegalCopyright", "Copyright (C) 2025 com.example. All rights reserved." "\0"
VALUE "OriginalFilename", "example.exe" "\0"
VALUE "ProductName", "example" "\0"
VALUE "ProductVersion", VERSION_AS_STRING "\0"
diff --git a/flutter_cache_manager/example/windows/runner/runner.exe.manifest b/flutter_cache_manager/example/windows/runner/runner.exe.manifest
index a42ea768..153653e8 100644
--- a/flutter_cache_manager/example/windows/runner/runner.exe.manifest
+++ b/flutter_cache_manager/example/windows/runner/runner.exe.manifest
@@ -9,12 +9,6 @@
-
-
-
-
-
-
diff --git a/flutter_cache_manager/lib/src/cache_store.dart b/flutter_cache_manager/lib/src/cache_store.dart
index bf283086..ca6e9188 100644
--- a/flutter_cache_manager/lib/src/cache_store.dart
+++ b/flutter_cache_manager/lib/src/cache_store.dart
@@ -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
@@ -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);
if (file.existsSync()) {
try {
diff --git a/flutter_cache_manager/lib/src/storage/cache_info_repositories/cache_info_repository.dart b/flutter_cache_manager/lib/src/storage/cache_info_repositories/cache_info_repository.dart
index 5a282b24..482b3877 100644
--- a/flutter_cache_manager/lib/src/storage/cache_info_repositories/cache_info_repository.dart
+++ b/flutter_cache_manager/lib/src/storage/cache_info_repositories/cache_info_repository.dart
@@ -1,4 +1,5 @@
import 'dart:async';
+import 'dart:io';
import 'package:flutter_cache_manager/src/logger.dart';
import 'package:flutter_cache_manager/src/storage/cache_object.dart';
@@ -49,6 +50,9 @@ abstract class CacheInfoRepository {
/// Deletes the cache data file including all cache data.
Future deleteDataFile();
+
+ /// The cached directory
+ Future getDirectory();
}
extension MigrationExtension on CacheInfoRepository {
diff --git a/flutter_cache_manager/lib/src/storage/cache_info_repositories/cache_object_provider.dart b/flutter_cache_manager/lib/src/storage/cache_info_repositories/cache_object_provider.dart
index 16bf5656..621ea3cf 100644
--- a/flutter_cache_manager/lib/src/storage/cache_info_repositories/cache_object_provider.dart
+++ b/flutter_cache_manager/lib/src/storage/cache_info_repositories/cache_object_provider.dart
@@ -4,7 +4,7 @@ import 'package:flutter_cache_manager/src/storage/cache_info_repositories/cache_
import 'package:flutter_cache_manager/src/storage/cache_info_repositories/helper_methods.dart';
import 'package:flutter_cache_manager/src/storage/cache_object.dart';
import 'package:path/path.dart';
-import 'package:path_provider/path_provider.dart';
+// import 'package:path_provider/path_provider.dart';
import 'package:sqflite/sqflite.dart';
const _tableCacheObject = 'cacheObject';
@@ -193,7 +193,7 @@ class CacheObjectProvider extends CacheInfoRepository
if (_path != null) {
directory = File(_path!).parent;
} else {
- directory = await getApplicationSupportDirectory();
+ directory = await getDirectory();
}
await directory.create(recursive: true);
if (_path == null || !_path!.endsWith('.db')) {
@@ -203,6 +203,12 @@ class CacheObjectProvider extends CacheInfoRepository
return _path!;
}
+ @override
+ Future getDirectory() async {
+ final path = await getDatabasesPath();
+ return Directory(path);
+ }
+
// Migration for pre-V2 path on iOS and macOS
Future _migrateOldDbPath(String newDbPath) async {
final oldDbPath = join(await getDatabasesPath(), '$databaseName.db');
diff --git a/flutter_cache_manager/lib/src/storage/cache_info_repositories/json_cache_info_repository.dart b/flutter_cache_manager/lib/src/storage/cache_info_repositories/json_cache_info_repository.dart
index 800f4ba1..faeca1fe 100644
--- a/flutter_cache_manager/lib/src/storage/cache_info_repositories/json_cache_info_repository.dart
+++ b/flutter_cache_manager/lib/src/storage/cache_info_repositories/json_cache_info_repository.dart
@@ -9,7 +9,7 @@ import 'package:flutter_cache_manager/src/storage/cache_info_repositories/cache_
import 'package:flutter_cache_manager/src/storage/cache_info_repositories/helper_methods.dart';
import 'package:flutter_cache_manager/src/storage/cache_object.dart';
import 'package:path/path.dart';
-import 'package:path_provider/path_provider.dart';
+import 'package:sqflite/sqflite.dart';
class JsonCacheInfoRepository extends CacheInfoRepository
with CacheInfoRepositoryHelperMethods {
@@ -210,7 +210,7 @@ class JsonCacheInfoRepository extends CacheInfoRepository
if (path != null) {
directory = File(path!).parent;
} else {
- directory ??= await getApplicationSupportDirectory();
+ directory ??= await getDirectory();
}
await directory!.create(recursive: true);
if (path == null || !path!.endsWith('.json')) {
@@ -220,4 +220,10 @@ class JsonCacheInfoRepository extends CacheInfoRepository
}
return _file!;
}
+
+ @override
+ Future getDirectory() async{
+ final path = await getDatabasesPath();
+ return Directory(path);
+ }
}
diff --git a/flutter_cache_manager/lib/src/storage/cache_info_repositories/non_storing_object_provider.dart b/flutter_cache_manager/lib/src/storage/cache_info_repositories/non_storing_object_provider.dart
index 92ea41c2..fe81e5af 100644
--- a/flutter_cache_manager/lib/src/storage/cache_info_repositories/non_storing_object_provider.dart
+++ b/flutter_cache_manager/lib/src/storage/cache_info_repositories/non_storing_object_provider.dart
@@ -1,5 +1,8 @@
+import 'dart:io';
+
import 'package:flutter_cache_manager/src/storage/cache_info_repositories/cache_info_repository.dart';
import 'package:flutter_cache_manager/src/storage/cache_object.dart';
+import 'package:sqflite/sqflite.dart';
class NonStoringObjectProvider implements CacheInfoRepository {
@override
@@ -72,4 +75,10 @@ class NonStoringObjectProvider implements CacheInfoRepository {
Future exists() async {
return false;
}
+
+ @override
+ Future getDirectory() async{
+ final path = await getDatabasesPath();
+ return Directory(path);
+ }
}
diff --git a/flutter_cache_manager/lib/src/storage/file_system/file_system_io.dart b/flutter_cache_manager/lib/src/storage/file_system/file_system_io.dart
index 15ab3901..6d086edb 100644
--- a/flutter_cache_manager/lib/src/storage/file_system/file_system_io.dart
+++ b/flutter_cache_manager/lib/src/storage/file_system/file_system_io.dart
@@ -1,8 +1,10 @@
+import 'dart:io' as io;
+
import 'package:file/file.dart' hide FileSystem;
import 'package:file/local.dart';
import 'package:flutter_cache_manager/src/storage/file_system/file_system.dart';
import 'package:path/path.dart' as p;
-import 'package:path_provider/path_provider.dart';
+import 'package:sqflite/sqflite.dart';
class IOFileSystem implements FileSystem {
final Future _fileDir;
@@ -11,7 +13,7 @@ class IOFileSystem implements FileSystem {
IOFileSystem(this._cacheKey) : _fileDir = createDirectory(_cacheKey);
static Future createDirectory(String key) async {
- final baseDir = await getTemporaryDirectory();
+ final baseDir = await getDirectory();
final path = p.join(baseDir.path, key);
const fs = LocalFileSystem();
@@ -28,4 +30,9 @@ class IOFileSystem implements FileSystem {
}
return directory.childFile(name);
}
+
+ static Future getDirectory() async{
+ final path = await getDatabasesPath();
+ return io.Directory(path);
+ }
}
diff --git a/flutter_cache_manager/pubspec.yaml b/flutter_cache_manager/pubspec.yaml
index 4e49f688..b4f7cbba 100644
--- a/flutter_cache_manager/pubspec.yaml
+++ b/flutter_cache_manager/pubspec.yaml
@@ -16,7 +16,6 @@ dependencies:
sdk: flutter
http: ^1.2.2
path: ^1.9.0
- path_provider: ^2.1.4
rxdart: '>=0.27.7 <0.29.0'
sqflite: ^2.3.3+1
uuid: ^4.4.2
diff --git a/flutter_cache_manager/test/cache_store_test.dart b/flutter_cache_manager/test/cache_store_test.dart
index b9a7ccd4..ddc693a9 100644
--- a/flutter_cache_manager/test/cache_store_test.dart
+++ b/flutter_cache_manager/test/cache_store_test.dart
@@ -402,6 +402,24 @@ void main() {
verify(config.mockRepo
.deleteAll(argThat(containsAll([co1.id, co2.id, co3.id])))).called(1);
});
+
+ test('Store should delete file when remove cached file', () async {
+ var config = createTestConfig();
+ var store = CacheStore(config);
+
+ await config.returnsFile(fileName);
+ config.returnsCacheObject(fileUrl, fileName, validTill, id: 1);
+
+ var cacheObject = await store.retrieveCacheData(fileUrl);
+
+ expect(cacheObject, isNotNull);
+ var fileInfo = await store.getFile(cacheObject!.key);
+ expect(await fileInfo?.file.exists(), isTrue);
+
+ await store.removeCachedFile(cacheObject);
+
+ expect(await fileInfo?.file.exists(), isFalse);
+ });
});
}
diff --git a/flutter_cache_manager_firebase/lib/src/firebase_cache_manager.dart b/flutter_cache_manager_firebase/lib/src/firebase_cache_manager.dart
index e45ed319..72b59e25 100644
--- a/flutter_cache_manager_firebase/lib/src/firebase_cache_manager.dart
+++ b/flutter_cache_manager_firebase/lib/src/firebase_cache_manager.dart
@@ -9,15 +9,15 @@ class FirebaseCacheManager extends CacheManager {
static const key = 'firebaseCache';
static final FirebaseCacheManager _instance =
- FirebaseCacheManager._(retryOptions: retryOptions, bucket: bucket);
+ FirebaseCacheManager._(retryOptions: _retryOptions, bucket: _bucket);
- static RetryOptions? retryOptions;
+ static RetryOptions? _retryOptions;
- static String? bucket;
+ static String? _bucket;
factory FirebaseCacheManager({RetryOptions? retryOptions, String? bucket}) {
- bucket = bucket;
- retryOptions = retryOptions;
+ _bucket = bucket;
+ _retryOptions = retryOptions;
return _instance;
}
diff --git a/flutter_cache_manager_firebase/pubspec.yaml b/flutter_cache_manager_firebase/pubspec.yaml
index b92533e7..ca104438 100644
--- a/flutter_cache_manager_firebase/pubspec.yaml
+++ b/flutter_cache_manager_firebase/pubspec.yaml
@@ -9,7 +9,7 @@ environment:
dependencies:
flutter:
sdk: flutter
- flutter_cache_manager: ^3.4.0
+ flutter_cache_manager: ^3.4.1
firebase_storage: '>=12.0.0 <13.0.0'
path_provider: ^2.1.4
path: ^1.9.0