FLUTTER ECOSYSTEM

oxequa/flutter_cache_image

ネットワークまたはFirebaseストレージの画像をロードおよびキャッシュするためのFlutterプラグインで、ダウンロードに失敗した場合の再試行メカニズムを備えています

flutter_cache_image のプロジェクト画像
Stars
34
Forks
24
最終プッシュ(UTC)
2022/05/21
プロジェクト状態
公開中
Oxequa GitHub avatar
GITHUB Organization

Oxequa ↗

言語DartRubyJavaKotlinSwiftObjective-C

技術トピック

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 4 件

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

README を開く / 閉じる

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.

dependencies:
  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.

Image(
    fit: BoxFit.cover,
    image: CacheImage('gs://your-project.appspot.com/image.png'),
),
Image(
    fit: BoxFit.cover,
    image:  CacheImage('https://hd.tudocdn.net/874944?w=646&h=284', duration: Duration(seconds: 2), durationExpiration: Duration(seconds: 10)),
),
FadeInImage(
    fit: BoxFit.cover,
    placeholder: AssetImage('assets/placeholder.png'),
    image: CacheImage('gs://your-project.appspot.com/image.jpg')
)

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