blurhash_dart
1.2.1, released 4 years ago by einval.de
A pure Dart implementation of the BlurHash algorithm for encoding and decoding images.
WASM-ready
What it does
It encodes raw images into compact BlurHash string representations and decodes BlurHash strings back into placeholder images. It also provides utility extensions for computations like color averages.
AI-written summary of version 1.2.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to display low-resolution placeholder gradients while full images load.
- You want to generate BlurHash strings from images on any Dart platform without platform-specific code.
Skip it when
- You are looking for a complete image loading and caching library.
- You need native UI widgets specifically designed for displaying blurhashes.
Strengths
- Pure Dart implementation supporting all Dart platforms.
- Provides both encoder and decoder out of the box.
Weaknesses
- Decoding returns raw pixels via the 'image' package, requiring manual conversion to displayable formats in Flutter.
- Computationally intensive tasks like encoding should be cached to avoid running on every build.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
import 'package:blurhash_dart/blurhash_dart.dart';
import 'package:image/image.dart' as img;
const hash = 'LEHV6nWB2yk8pyo0adR*.7kCMdnj';
BlurHash blurHash = BlurHash.decode(hash);
img.Image image = blurHash.toImage(35, 20);Alternatives
Packages that do the same job and could replace blurhash_dart.
- jpeg_encode
A minimalistic JPEG encoder for Dart and Flutter.
43Compare
Works with
Packages commonly used together with blurhash_dart: ones it builds on, ones built on it, and its own family.
- imageblurhash_dart depends on itPure Dart library to load, manipulate, encode, and decode various image formats.
- matrixBuilt on blurhash_dartMatrix (matrix.org) SDK written in Dart.
- flyer_chat_image_messageBuilt on blurhash_dartImage message widget for Flutter chat apps with cross-platform caching, BlurHash, and ThumbHash.
- blurhashBuilt on blurhash_dartA very compact representation of a placeholder for an image.