cross_file_manager 0.3.1 copy "cross_file_manager: ^0.3.1" to clipboard
cross_file_manager: ^0.3.1 copied to clipboard

Can read files from assets, Internet (by URL), zip archives by loader priority.

CrossFileManager #

Transparent reading of files wherever they are located: assets, Internet (by URL), zip archives.

Features #

You can choose the priority for uploaders yourself. For example, if the file is not in the assets, an attempt will be made to get the file from the cloud.

You can develop own loader for download files from Firebase, Firestore, Amazon AWS, Google Drive, Microsoft Azure Cloud Storage, OneDrive, Dropbox, etc. - any data source can be included in the CrossFileManager. See class Loader and already implemented loaders.

Can retrieve the needed file from an archive. It comes in handy when you need to download thousands of small files.

Can memorize a received file and retrieve it from local storage the next time it is requested.

Able to download files in formats:

  • String
  • Image like dart.ui
  • Image like package:flutter/widgets.dart
  • File, binary data

How it works #

A picture is worth a thousand words.

Direct path to file

Direct path to file - CrossFileManager

Direct path to file with cache

Direct path to file with cache - CrossFileManager

ZIP path to file

ZIP path to file - CrossFileManager

Getting started #

Add this package to pubspec.yaml. See Installing tab above.

Usage #

Create a manager for App:

final fm = CrossFileManager.create(
  loaders: const [
    PlainAssetsLoader(),
    ZipAssetsLoader(),
    PlainFileLoader(),
    ZipFileLoader(),
  ],
);

Use the manager in the App:

final String? r = await fm.loadString(path);
import 'dart:ui' as ui;

final ui.Image? r = await fm.loadImageUi(path);
import 'package:flutter/widgets.dart' as widgets;

final widgets.Image? r = await fm.loadImageWidget(path);
final File? r = await fm.loadFile(path);
final bool r = await fm.exists(path);
final bool r = await fm.existsInCache(path);
/// Just add file to cache for fast access in the future.
await fm.warmUp(path);

The manager announced above will search file by path in the local assets, then in the zip archives of local assets, then in the local filesystem, then in the zip archives of local filesystem.

It will return the first file found.

See example/main.dart for more use cases:

Example App with CrossFileManager

4
likes
0
pub points
0%
popularity

Publisher

verified publishersyrokomskyi.com

Can read files from assets, Internet (by URL), zip archives by loader priority.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

archive, flutter, flutter_cache_manager, path, path_provider, stash, stash_memory

More

Packages that depend on cross_file_manager