v1.2.0blurhash
圖像佔位符的非常緊湊的表示形式。
79喜歡 4890近 30 天下載150Pub 分數
AndroidiOSWeb
圖像佔位符的緊湊表示形式。
{"sdk":"flutter"}{"sdk":"flutter"}^1.0.0^2.0.2^1.2.0^4.0.0{"sdk":"flutter"}^5.0.0以下為英文專案原文快照,最新內容請造訪 GitHub。
Compact representation of a placeholder for an image.
| Android | iOS | Web |
|---|---|---|
| ✔️ | ✔️ | ✔️ |
To use this plugin, add blurhash as a dependency in your pubspec.yaml file.
void blurHashEncode() async {
ByteData bytes = await rootBundle.load("image.jpg");
Uint8List pixels = bytes.buffer.asUint8List();
var blurHash = await BlurHash.encode(pixels, 4, 3);
}
void blurHashDecode() async {
Uint8List? imageDataBytes;
try {
imageDataBytes = await BlurHash.decode(blurhash, 20, 12);
} on PlatformException catch (e) {
throw Exception(e.message);
}
}