cached_remote_file 1.0.13 copy "cached_remote_file: ^1.0.13" to clipboard
cached_remote_file: ^1.0.13 copied to clipboard

CachedRemoteFile is a Flutter package for efficient remote file fetching and local caching, enhancing performance and reducing data usage.

Cached Remote File #

style: very good analysis Powered by Mason License: MIT codecov Release Workflow

CachedRemoteFile is a Flutter package for fetching remote files and caching them locally. It allows you to download files from the internet and store them locally, enhancing performance and reducing data usage. This Package is inspired by internet_file

Installation #

Install via flutter pub add:

dart pub add cached_remote_file

Then, run flutter pub get to fetch the package.


Usage #

Import the package and create an instance of CachedRemoteFile to start fetching and caching remote files.


import 'package:cached_remote_file/cached_remote_file.dart';

// Create a CachedRemoteFile instance
final cachedRemoteFile = CachedRemoteFile();

// Fetch a remote file and store it locally
final url = 'https://example.com/your-remote-file.txt';

try {
  final fileData = await cachedRemoteFile.get(url);
  if (fileData != null) {
    // Handle the downloaded file data (Uint8List)
  }
} catch (e) {
  // Handle errors
}

You can customize the behavior of the get method by providing optional parameters, such as headers, progress callbacks, and more.


// Example with optional parameters
final url = 'https://example.com/your-remote-file.txt';
final headers = {'Authorization': 'Bearer your_access_token'};

try {
  final fileData = await cachedRemoteFile.get(
    url,
    headers: headers,
    force: false,
    method: 'GET',
    timeout: const Duration(seconds: 30),
    downloadProgressValue: (double percentage) {
      // Handle download progress
    },
  );
  if (fileData != null) {
    // Handle the downloaded file data (Uint8List)
  }
} catch (e) {
  // Handle errors
}

Documentation #

For detailed information on the package and its classes, please refer to the Dart documentation.

License #

This package is distributed under the MIT License. See the LICENSE file for more details.

2
likes
160
pub points
4%
popularity

Publisher

verified publisheradiltirur.dev

CachedRemoteFile is a Flutter package for efficient remote file fetching and local caching, enhancing performance and reducing data usage.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_cache_manager, http

More

Packages that depend on cached_remote_file