FLUTTER ECOSYSTEM

prongbang/cached_memory_image

一個 Flutter 庫,用於從 Base64 和 Uint8List 顯示圖像,並將其保留在快取目錄中。

cached_memory_image 專案封面
Stars
3
Forks
8
最近推送(UTC)
2023年11月25日
專案狀態
未封存
prongbang GitHub avatar
GITHUB User

prongbang ↗

Devไปวันๆ https://fb.me/async.true

Founder, Inteniquetic, Co-Founder Innotech DevelopmentBangkok, Thailand官方網站 ↗
語言DartRubySwiftKotlinObjective-CMakefile

技術主題

此儲存庫發佈的套件

使用的依賴

依賴清單 4 項

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

展開 / 收合專案 README

cached_memory_image

pub package

A Flutter library to show images from the Base64, Uint8List and keep them in the cache directory.

Features

Check file is exists
final cachedImageManager = CachedImageBase64Manager.instance();

await cachedImageManager?.isExists('app://image/1');
await cachedImageManager?.removeFile('app://image/1');
Cached Image from Base64
  • Widget
CachedMemoryImage(
  uniqueKey: 'app://image/1',
  base64: 'iVBORw0KGgoAAAANSUhEUgAAAk0AAAFwCAYAAACl9k...',
),
  • Image Provider
CachedMemoryImageProvider(
  'app://image/6',
  base64: 'iVBORw0KGgoAAAANSUhEUgAAAk0AAAFwCAYAAACl9k...',
)
Cached Image from Uint8List
  • Widget
CachedMemoryImage(
  uniqueKey: 'app://image/1',
  bytes: Uint8List.fromList([1,2,3,4,5]),
)
  • Image Provider
CachedMemoryImageProvider(
  'app://image/5',
  bytes: Uint8List.fromList([1,2,3,4,5]),
)

Getting started

It is really easy to use! You should ensure that you add the cached_memory_image as a dependency in your flutter project.

cached_memory_image: ^1.5.0

Usage

  • Cached image from Base64 and Display
Padding(
  padding: const EdgeInsets.all(8.0),
  child: CachedMemoryImage(
    uniqueKey: 'app://image/1',
    base64: 'iVBORw0KGgoAAAANSUhEUgAAAk0AAAFwCAYAAACl9k...',
  ),
)
  • Cached image from Uint8List and Display
Padding(
  padding: const EdgeInsets.all(8.0),
  child: CachedMemoryImage(
    uniqueKey: 'app://image/1',
    bytes: Uint8List.fromList([1,2,3,4,5]),
  ),
)

How it works

The cached memory images stores and retrieves files using the flutter_cache_manager.