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

套件詳情v0.0.1-dev.7

fast_blurhash

一個高效率的 Dart FFI 套件,用於解碼 BlurHash,利用 Rust 實現更快的處理速度。

AndroidiOSmacOSWindowsLinux
近 30 天下載
53
喜歡數
34
Pub 分數
150

安裝套件

flutter pub add fast_blurhash

套件介紹

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

fast_blurhash 是一個高效率的 Dart FFI 套件,透過使用 Rust 進行高效運算,加速 BlurHash 解碼。它能快速產生與呈現低解析度的佔位圖像,非常適合提升影像載入工作流程中的感知效能。透過將密集型運算交由原生 Rust 程式碼處理,相比純 Dart 實作,大幅降低 CPU 開銷。此套件支援 Android、iOS、macOS、Windows 與 Linux 多個平台,適用於需要在影像載入期間提供順暢視覺回饋的跨平台應用。

適用情境

  • 快速圖像佔位符渲染
  • 改進的應用感知效能
  • 高效加載遠端圖像
  • 即時預覽產生
  • 背景圖像處理
  • 跨平台相容性

主要特色

  • 基於 Rust 的高效能
  • Dart FFI 結合
  • 多平台支援
  • 低記憶體佔用
  • 高速解碼
  • 無縫的 Flutter 結合

適合對象

  • 載入大量圖片的應用
  • 性能關鍵的UI
  • 圖像密集型儀表板
  • 使用佔位符進行原型設計
  • 尋求原生速度的開發者

使用建議

  • 本地建構需要 Rust 工具鏈
  • 僅限 BlurHash 解碼(不包含編碼)
  • 平台特定的原生依賴
  • CI/CD上的潛在構建複雜性
  • 可能會稍微增加應用二進制檔案大小

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

fast_blurhash

A Dart FFI package project that uses Rust to decode the blurhash and encode the final image, utilizing FFI to call these functions. This package exists because it works +20x faster on average than the common Dart implementation and can be tested in release mode by running the benchmarks.dart demo.

It only works with the latest version of Flutter on the main branch and requires the following feature to be enabled: flutter config --enable-native-assets. For more details, refer to this issue.

Status

  • Uses experimental APIs which might change in the future.
  • The first time call takes longer than the average time so I have added a setup function to do a warmup call.
  • Tested only on iOS and MacOs in release mode.
  • Significant performance difference between release mode and debug mode; do not rely on debug mode results.

Project structure

This template uses the following structure:

  • rust: Contains the rust source code.

  • lib: Contains the Dart code that defines the API of the plugin, and which calls into the native code using dart:ffi.

Benchmarks

To test the performance of the package in release mode, run the benchmarks.dart demo.

So far I have tried this one iOS and macos release mode, don't run the benchmarks on debug mode.

Run the benchmark using : flutter run -t lib/benchmarks.dart --release

iPhone 15 pro:
screenshot from the benchmarks demo on iPhone 15 pro
M1 Macbook Pro:
screenshot from the benchmarks demo on macbook pro

所屬分類

依賴

依賴清單 5 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。