Search packages, repositories and app categories

Package detailsv0.0.1-dev.7

fast_blurhash

A high-performance Dart FFI package for decoding BlurHash, leveraging Rust for faster processing.

AndroidiOSmacOSWindowsLinux
30-day downloads
53
Likes
34
Pub points
150

Install package

flutter pub add fast_blurhash

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

fast_blurhash is a high-performance Dart FFI package that accelerates BlurHash decoding by leveraging Rust for efficient computation. It enables fast generation and rendering of low-resolution placeholder images, ideal for improving perceived performance in image loading workflows. By offloading intensive operations to native Rust code, it significantly reduces CPU overhead compared to pure Dart implementations. The package supports multiple platforms including Android, iOS, macOS, Windows, and Linux, making it suitable for cross-platform applications requiring smooth visual feedback during image loading.

Use cases

  • Fast image placeholder rendering
  • Improved app perceived performance
  • Efficient loading of remote images
  • Real-time preview generation
  • Background image processing
  • Cross-platform compatibility

Key features

  • Rust-powered performance
  • Dart FFI integration
  • Multi-platform support
  • Low memory footprint
  • High-speed decoding
  • Seamless Flutter integration

Suitable for

  • Apps with heavy image loading
  • Performance-critical UIs
  • Image-heavy dashboards
  • Prototyping with placeholders
  • Developers seeking native speed

Considerations

  • Requires Rust toolchain for local builds
  • Limited to BlurHash decoding (not encoding)
  • Platform-specific native dependencies
  • Potential build complexity on CI/CD
  • May increase app binary size slightly

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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

Categories

Dependencies

Dependency list 5 items

Source repository

Projects using this package

No data available yet.