### Flutter Cache Manager Example App Source: https://pub.dev/packages/flutter_cache_manager/example This is the main entry point for the example application demonstrating the flutter_cache_manager functionalities. It sets up the plugin's logging level and initializes the example app structure. ```dart import 'package:baseflow_plugin_template/baseflow_plugin_template.dart'; import 'package:example/plugin_example/download_page.dart'; import 'package:example/plugin_example/floating_action_button.dart'; import 'package:flutter/foundation.dart' show kDebugMode; import 'package:flutter/material.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; void main() { runApp( BaseflowPluginExample( pluginName: 'Flutter Cache Manager', githubURL: 'https://github.com/Baseflow/flutter_cache_manager', pubDevURL: 'https://pub.dev/packages/flutter_cache_manager', pages: [CacheManagerPage.createPage()], ), ); CacheManager.logLevel = CacheManagerLogLevel.verbose; } const url = 'https://picsum.photos/200/300'; /// Example [Widget] showing the functionalities of flutter_cache_manager class CacheManagerPage extends StatefulWidget { const CacheManagerPage({super.key}); static ExamplePage createPage() { return ExamplePage(Icons.save_alt, (context) => const CacheManagerPage()); } @override CacheManagerPageState createState() => CacheManagerPageState(); } class CacheManagerPageState extends State { Stream? fileStream; void _downloadFile() { setState(() { fileStream = DefaultCacheManager().getFileStream(url, withProgress: true); }); } @override Widget build(BuildContext context) { if (fileStream == null) { return Scaffold( body: const ListTile( title: Text('Tap the floating action button to download.'), ), floatingActionButton: Fab( downloadFile: _downloadFile, ), ); } return DownloadPage( fileStream: fileStream!, downloadFile: _downloadFile, clearCache: _clearCache, removeFile: _removeFile, ); } void _clearCache() { DefaultCacheManager().emptyCache(); setState(() { fileStream = null; }); } void _removeFile() { DefaultCacheManager().removeFile(url).then((value) { if (kDebugMode) { print('File removed'); } }).onError((error, stackTrace) { if (kDebugMode) { print(error); } }); setState(() { fileStream = null; }); } } ``` -------------------------------- ### Example pubspec.yaml Entry Source: https://pub.dev/packages/flutter_cache_manager/install This is how the dependency will appear in your pubspec.yaml file after running the add command. ```yaml dependencies: flutter_cache_manager: ^3.4.1 ``` -------------------------------- ### Get Image File with Resizing Source: https://pub.dev/packages/flutter_cache_manager Obtains an image file from a URL, resizing it to specified dimensions while maintaining aspect ratio. The original image is also cached for future resizing operations with different parameters. ```dart Stream getImageFile(String url, { String key, Map headers, bool withProgress, int maxHeight, int maxWidth, }) ``` -------------------------------- ### Get Single File Source: https://pub.dev/packages/flutter_cache_manager The easiest way to get a single file from the cache manager. This method attempts to retrieve the file from the cache first, and if not found, it downloads it from the specified URL. ```dart var file = await DefaultCacheManager().getSingleFile(url); ``` -------------------------------- ### Get File Stream with Progress Source: https://pub.dev/packages/flutter_cache_manager Retrieves a file via a stream, optionally providing download progress. When `withProgress` is true and the file is not in the cache, the stream emits `DownloadProgress` events. ```dart getFileStream(url, withProgress: true) ``` -------------------------------- ### Get Single File from Firebase Storage Source: https://pub.dev/packages/flutter_cache_manager_firebase Use this snippet to fetch a single file stored in Firebase Storage using the FirebaseCacheManager. Ensure you have initialized Firebase in your project. ```dart var file = await FirebaseCacheManager().getSingleFile(url); ``` -------------------------------- ### Custom Cache Manager Configuration Source: https://pub.dev/packages/flutter_cache_manager Demonstrates how to create a custom CacheManager instance with specific configurations for stale period, maximum cache objects, and custom file system and service implementations. The `key` parameter is mandatory for uniquely identifying the cache manager. ```dart 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(), ), ); } ``` -------------------------------- ### Process Exited with Code 0 Source: https://pub.dev/packages/flutter_cache_manager/score/log.txt This log indicates that a process, likely related to cache management operations, completed successfully. However, in certain contexts, this might still signify an issue if the expected outcome was not achieved. Review the surrounding logs for more details on the operation that was performed. ```text STOPPED: 2026-06-03T17:05:03.619843Z ``` -------------------------------- ### Add flutter_cache_manager Dependency Source: https://pub.dev/packages/flutter_cache_manager/install Run this command in your terminal to add the package to your pubspec.yaml file. ```bash $ flutter pub add flutter_cache_manager ``` -------------------------------- ### Process Execution Log Source: https://pub.dev/packages/flutter_cache_manager_firebase/score/log.txt Logs the status of a process execution. Indicates if the process exited successfully. ```text ### Execution of process exited 0 STOPPED: 2026-06-03T14:09:23.239975Z ``` -------------------------------- ### Import File Class Source: https://pub.dev/packages/flutter_cache_manager/changelog Import the File class from the flutter_cache_manager package to manage file operations. ```dart import 'package:flutter_cache_manager/file.dart' as cache_file; ``` -------------------------------- ### Add flutter_cache_manager_firebase Dependency Source: https://pub.dev/packages/flutter_cache_manager_firebase/install Run this command in your terminal to add the package to your project's dependencies. ```bash $ flutter pub add flutter_cache_manager_firebase ``` -------------------------------- ### Set Cache Manager Log Level Source: https://pub.dev/packages/flutter_cache_manager/changelog Manage the log level for the cache manager. By default, failed downloads are not printed. Set to verbose for detailed logging. ```dart CacheManager.logLevel = CacheManagerLogLevel.verbose; ``` -------------------------------- ### MIT License for flutter_cache_manager_firebase Source: https://pub.dev/packages/flutter_cache_manager_firebase/license This snippet displays the full MIT license text for the flutter_cache_manager_firebase package. It outlines the permissions and conditions for using, copying, modifying, and distributing the software. ```plaintext MIT License Copyright (c) 2020 Baseflow Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` -------------------------------- ### Initialize FirebaseCacheManager with Custom Bucket Source: https://pub.dev/packages/flutter_cache_manager_firebase Instantiate FirebaseCacheManager with a specific Firebase Storage bucket name. This is useful if your project uses a non-default bucket. ```dart FirebaseCacheManager(bucket: "my-bucket"); ``` -------------------------------- ### Import flutter_cache_manager in Dart Source: https://pub.dev/packages/flutter_cache_manager/install Use this import statement in your Dart files to access the package's functionalities. ```dart import 'package:flutter_cache_manager/flutter_cache_manager.dart'; ``` -------------------------------- ### Import flutter_cache_manager_firebase in Dart Source: https://pub.dev/packages/flutter_cache_manager_firebase/install Use this import statement in your Dart files to access the package's functionalities. ```dart import 'package:flutter_cache_manager_firebase/flutter_cache_manager_firebase.dart'; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.