Skip to content
An s3 image cache for flutter
Dart Ruby Objective-C Java
Branch: master
Clone or download
Latest commit 5cba2b1 Jun 7, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example Use remote ID instead of cache ID to refetch expired url Sep 25, 2018
lib Use remote ID instead of cache ID to refetch expired url Sep 25, 2018
test Fix warning in publish test Sep 7, 2018
.gitignore Initial commit Aug 23, 2018
CHANGELOG.md Initial commit Aug 23, 2018
LICENSE Initial commit Aug 23, 2018
README.md
analysis_options.yaml Initial commit Aug 23, 2018
pubspec.yaml
s3_cache_image.iml

README.md

Cached network image

A flutter library to show image from S3 repository and keep them in the cache directory.

This package is based from [https://github.com/renefloor/flutter_cached_network_image]. With how to download and show images from S3 repository in mind.

How to add

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

dependencies:
  s3_cache_image: "^0.0.1"

Add it to your dart file:

import 'package:s3_cache_image/s3_cache_image.dart';

How to use

S3ImageCache can be used directly or through the ImageProvider.

S3CachedImage(
              fit: BoxFit.cover,
              width: width,
              height: width,
              onExpired: null,
              onDebug: null,
              imageURL: 'INSERT S3 URL HERE',
              cacheId: 'INSERT CACHE ID HERE',
              errorWidget: Center(child: Text('ERROR')),
              placeholder: Center(child: Text('Loading')))

Files stored in system temporary folder, so it can be cleared automatically by OS if necessary.

Set directory path:

setS3CachePath('/s3/cache/newImage/hello/');

Get cache size will return future:

getS3CacheSize();

Purging cache directory will return future:

clearS3Cache();
You can’t perform that action at this time.