cached_firestorage 0.1.1 copy "cached_firestorage: ^0.1.1" to clipboard
cached_firestorage: ^0.1.1 copied to clipboard

A Flutter utility that manages Firebase Storage download URLs and caches the results

Cached Firestorage #

pub license: MIT style: flutter_lints dart Github

A Flutter utility that manages Firebase Storage download URLs and caches the results

Usage #

Cached Firestorage exposes a Singleton that you can access via CachedFirestorage.instance

The default cache duration is of 360s (6h): you can customize this by passing the number of seconds to the instance:

CachedFirestorage.instance.cacheTimeout = 30;

APIs #

getDownloadURL #

This is the main api: it's a Future<String> that resolves returning in its snapshot.data the Firebase Storage's download url of the requested resource, and caches the result, so every time you will ask for it again, you'll have direct access to the resource's url.
getDownloadURL always returns a String, meaning that if no file is matched and no fallbackFilePath (see below) is provided, it will return '';

Parameters (all named)

  • String mapKey: The key at which your cached entry will be stored
  • String filePath: The file path on your Firebase Storage bucket
  • String? storageKey: You can split the cache into sub-paths: this is the subpath key
  • String? fallbackFilePath: If provided, this is the path that will be returned in case of no matches on Firebase Storage

removeCacheEntry #

By calling this api you can remove a cache entry when you want. Very useful in case you need to update the download URL of a previously stored resource before the cache expires.

Parameters (all named)

  • String mapKey: the key to be removed from the cache
  • String? storageKey: the storage key in which Cached Firestorage should search the mapKey

Widgets #

RemotePicture #

Since Firebase Storage is particularly useful when it's a matter of hosting pictures, CachedFirestorage ships with a built-in widget that you can use to display an image stored in your bucket.

Parameters (all named)

  • String imagePath: The file path on your Firebase Storage bucket
  • String mapKey: The key at which your cached entry will be stored
  • bool useAvatarView = false: If true, it will render your image as an AvatarView
  • String? storageKey: You can split the cache into sub-paths: this is the subpath key
  • String? placeholder: The file path of a local asset to use as placeholder
  • double? avatarViewRadius: The radius of the avatar (mandatory if useAvatarView == true)
  • BoxFit? fit: Optional parameter to be passed to a non-avatar image (ignored if useAvatarView == true)
5
likes
0
pub points
77%
popularity

Publisher

verified publisherrollercoders.net

A Flutter utility that manages Firebase Storage download URLs and caches the results

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

adaptive_spinner, avatar_view, cached_network_image, firebase_storage, flutter, get_storage

More

Packages that depend on cached_firestorage