cache_image 1.0.5

Flutter Cache Image #

pub package

A Flutter plugin to load and cache network or firebase storage images with a retry mechanism if the download fails.

This package supports the download of images from a standard network path and from a firebase storage gs path.

Images are stored in the temporary directory of the app.

Usage #

To use this plugin, add firebase_storage as a dependency in your pubspec.yaml file.

  cache_image: "^1.0.5"

Import cache_image in a dart file:

import 'package:cache_image/cache_image.dart';

To support firebase storage download the generated google-services.json file and place it inside android/app. Next, modify the android/build.gradle file and the android/app/build.gradle file to add the Google services plugin as described by the Firebase assistant.

How to use #

Cache Image can be used with any widget that support an ImageProvider.

    fit: BoxFit.cover,
    image: CacheImage('gs://'),
    fit: BoxFit.cover,
    image:  CacheImage('', duration: Duration(seconds: 2), durationExpiration: Duration(seconds: 10)),
    fit: BoxFit.cover,
    placeholder: AssetImage('assets/placeholder.png'),
    image: CacheImage('gs://')

See the example directory for a complete sample app using Cache Image.

1.0.5 #

  • Bug fix

1.0.4 #

  • Doc updated
  • Retry mechanism improved

1.0.3 #

  • Code format

1.0.2 #

  • Pub badge
  • Package description update

1.0.1 #

  • Doc updated
  • Example updated

1.0.0 #

  • Stable release
  • Update flutter minimum version
  • Support to auto-retry if download fails

0.0.3 #

  • Dependencies updated
  • Bug fix

0.0.2 #

  • Bug fix temp dir

0.0.1 #

  • Initial release, support to firebase and standard network

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  cache_image: ^1.0.5

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:cache_image/cache_image.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 21, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
firebase_storage ^3.1.0 3.1.1
flutter 0.0.0
path_provider ^1.5.1 1.6.1
Transitive dependencies
async 2.4.0
charcode 1.1.3
collection 1.14.11 1.14.12
firebase 7.2.1
firebase_core 0.4.4
firebase_core_platform_interface 1.0.2
firebase_core_web 0.1.1+2
flutter_web_plugins 0.0.0
http 0.12.0+4
http_parser 3.1.3
js 0.6.1+1
matcher 0.12.6
meta 1.1.8
path 1.6.4
pedantic 1.9.0
platform 2.2.1
quiver 2.1.2+1
sky_engine 0.0.99
source_span 1.6.0
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies