Package selection guidance compiled from public package information, community data, and project usage.
A Flutter package that provides a cached ImageProvider for images stored in Firebase Cloud Storage. It simplifies loading and displaying remote images by handling caching, error states, and loading indicators automatically. Designed to work seamlessly with Firebase's storage system, it reduces boilerplate code and improves performance by avoiding redundant downloads. The package is lightweight and integrates directly into existing Flutter apps without complex setup.
Use cases
Loading images from Firebase Cloud Storage
Caching remote images to improve performance
Displaying placeholder or error images
Integrating with Flutter's Image widget
Reducing network requests through caching
Key features
Automatic image caching
Support for loading, error, and placeholder states
Seamless integration with Firebase Cloud Storage
Minimal boilerplate required
Efficient memory and disk usage
Suitable for
Apps using Firebase Cloud Storage for images
Developers seeking simple image loading
Projects requiring offline image access
Apps with high-frequency image display
Teams prioritizing performance and reliability
Considerations
Requires Firebase Cloud Storage setup
Limited to Firebase-hosted images
No built-in image transformation
Does not support all image formats
Depends on Firebase SDK availability
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
🔥 Firebase Image Provider
A cached Flutter ImageProvider for Firebase Cloud Storage image objects.
How to use
Make sure you already have Firebase set up on all platforms you want to use this on.
Supply the FirebaseImage widget with the image's URI (e.g. gs://bucket123/userIcon123.jpg) and then put that in any widget that accepts an ImageProvider (most image related widgets will (e.g. Image, ImageIcon, etc.)). Please note that you do need the gs:// prefix currently.
See the below for example code.
How does it work?
The code downloads the image (object) into memory as a byte array.
Unless disabled using the cacheRefreshStrategy: CacheRefreshStrategy.NEVER option, it gets the object's last update time from metadata (a millisecond precision integer timstamp) and uses that as a defacto version number. Therefore, any update to that remote object will result in the new version being downloaded.
The image byte array in memory then gets saved to a file in the temporary directory of the app and that location is saved in a persistant database. The OS can clean up this directory at any time however.
Metadata retrival is a 'Class B Operation' and has 50,000 free operations per month. After that, it is billed at $0.04 / 100,000 operations and so the default behaviour of cacheRefreshStrategy: CacheRefreshStrategy.BY_METADATA_DATE may incur extra cost if the object never changes. This makes this implementation a cost effective stratergy for caching as the entire object doesn't have to be transfered just to check if there have been any updates. Essentailly, any images will only need to be downloaded once per device.
Example
import'package:flutter/material.dart';
import'package:firebase_image/firebase_image.dart';
classIconImageextendsStatelessWidget{
@overrideWidgetbuild(BuildContext context) {
returnScaffold(
appBar: AppBar(
title: Text('Firebase Image Provider example'),
),
body: Image(
image: FirebaseImage('gs://bucket123/userIcon123.jpg'),
// Works with standard parameters, e.g.
fit: BoxFit.fitWidth,
width: 100,
// ... etc.
),
);
}
}