搜尋套件、儲存庫與 APP 分類

套件詳情v1.5.0

cached_memory_image

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

AndroidiOSmacOSWindowsLinux
近 30 天下載
5030
喜歡數
50
Pub 分數
140

安裝套件

flutter pub add cached_memory_image

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

CachedMemoryImage 是一個 Flutter 套件,專為從 Base64 字串或 Uint8List 資料高效顯示影像而設計,同時在本機快取它們。它透過將解碼後的影像儲存在裝置的快取目錄中,確保快速載入影像,減少重複處理與網路請求。適用於處理動態或經常存取的影像之應用程式,支援 Android、iOS、macOS、Windows 及 Linux 等多個平台。該函式庫透過最少設定簡化影像管理,並能順暢整合至現有的 Flutter 專案中。

適用情境

  • 顯示base64編碼的圖像
  • 快取本機影像資料
  • 從 Uint8List 加載影像
  • 減少重複的圖像解碼
  • 離線影像存取
  • 提升應用性能

主要特色

  • 支援 Base64 和 Uint8List 輸入
  • 本機快取儲存在裝置快取目錄中
  • 跨平台相容性
  • 從快取自動重用影像
  • 最小設定需求
  • 高效記憶體使用

適合對象

  • 動態圖像內容的應用程式
  • 離線優先的應用程式
  • 高頻圖像渲染
  • 媒體密集型使用者介面
  • 尋求簡單圖像快取的開發者
  • 需要輕量級圖像處理的項目

使用建議

  • 快取大小無法設定
  • 無內建影像壓縮
  • 依賴系統快取目錄
  • 對快取淘汰策略的控制有限
  • 未針對大型圖像數據集進行優化
  • 如需,需要手動清除快取

原始 README

以下為關聯原始碼儲存庫的 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.

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案