Holmusk / s3_cache_image

An s3 image cache for flutter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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();

About

An s3 image cache for flutter

License:MIT License


Languages

Language:Dart 85.2%Language:Ruby 9.7%Language:Objective-C 3.5%Language:Java 1.7%