सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
blurhash_ffi एक उच्च प्रदर्शन फ्लटर पैकेज है जो मूल FFI बाइंडिंग का उपयोग करके संक्षिप्त, दृश्य रूप से आकर्षक धुंधली छवि स्थानापन्न उत्पन्न करता है। यह BlurHash स्ट्रिंग्स को प्रभावी ढंग से कोड और डीकोड करता है, जिससे शुद्ध डार्ट वास्तविकता पर निर्भरता के बिना तेजी से स्थानापन्न रेंडरिंग संभव होती है। छवि लोडिंग के दौरान अनुभवजन्य प्रदर्शन में सुधार करने के लिए उपयुक्त है, यह Android, iOS, macOS, Windows और Linux पर काम करता है। पैकेज दृश्य गुणवत्ता के साथ गति और न्यूनतम मेमोरी उपयोग को प्राथमिकता देता है।
उपयोग
लोडिंग स्क्रीन स्थानाभारक
इमेज गैलरी प्रीव्यू
नेटवर्क इमेज लोडिंग इंडिकेटर्स
ऑफलाइन सामग्री स्थानापन्न
मीडिया-भारी ऐप्स में प्रदर्शन अनुकूलन
मुख्य विशेषताएँ
मूल एफएफआई प्रदर्शन
प्लेटफॉर्म के अनुकूल समर्थन
संक्षिप्त हैश संकलन
त्वरित डीकोडिंग
कम मेमोरी फुटप्रिंट
इनके लिए उपयुक्त
भारी छवि लोडिंग वाले ऐप्स
उच्च-प्रदर्शन UI आवश्यकताएँ
मूल गति की खोज कर रहे विकासकर्ता
हल्के स्थानापन्न की आवश्यकता वाले प्रोजेक्ट
बहु-प्लेटफॉर्म फ्लटर ऐप्स
विचार योग्य बातें
मूल निर्माण सेटअप की आवश्यकता है
केवल BlurHash प्रारूप तक सीमित
एप्लिकेशन के आकार में थोड़ा वृद्धि हो सकती है
जटिल छवि प्रसंस्करण के लिए उपयुक्त नहीं
प्लेटफॉर्म-विशिष्ट FFI लाइब्रेरी पर निर्भर करता है
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
blurhash_ffi
A Blurhash compact Image placeholder encoder and decoder FFI implementation for Flutter in Rust via experemental feature Native Assets.
Matches the official Blurhash implementation in performance and quality.
Supports
Platform
Status
Description
Android
✅
-
iOS
✅
-
macOS
✅
-
Linux
⚠️
Not tested
Windows
✅
-
Web
❌
Rust can compiled to WebAssembly, but no supported yet. This library compiled on standalone wasm module (not in Empscripten, AssemblyScript) that Dart can't be use non-JS enviroments. Also, Dart should use FFI bindings for call wasm module. Stopped issues: comment
Installation
Add dependency to your pubspec.yaml file following the command below:
For dart projects:
dart pub add dart_blurhash_ffi
For flutter projects:
dart pub add flutter_blurhash_ffi
Usage
To use this plugin, add blurhash_ffi as a dependency in your pubspec.yaml file
Flutter usage
import'package:flutter_blurhash_ffi/flutter_blurhash_ffi.dart';
/// Encoding and Decoding all in One Step////// `ImageProvider` in -> Send your Image to be encoded./// `ImageProvider` out -> Get your blurry image version.classBlurhashMyImageextendsStatelessWidget{
finalString imageUrl;
constBlurhashMyImage({requiredthis.imageUrl, super.key});
@overrideWidgetbuild(BuildContext context) {
returnImage(
image: BlurhashFfiImage.fromImageProvider(
NetworkImage(imageUrl), // you can use any image provider of your choice.
decodingHeight: 1920,
decodingWidth: 1080,
),
alignment: Alignment.center,
fit: BoxFit.cover
);
}
}
classBlurhashMyImage2extendsStatelessWidget{
finalString blurhash;
constBlurhashMyImage2({requiredthis.blurhash, super.key});
@overrideWidgetbuild(BuildContext context) {
returnImage(
image: BlurhashFfiImage(blurhash),
width: 200,
height: 200,
alignment: Alignment.center,
fit: BoxFit.cover
);
}
}
[!WARNING]
Not recommend use it (without blurhash string param), because in this case, encoding and decoding will be performed. This effect can be obtained almost through ImageFiltered.
Encoding
Encoding now uses sync interface (without Future).
import'package:dart_blurhash_ffi/dart_blurhash_ffi.dart';
finalUint8List blurhashImageBytes = File('assets/image.webp').readAsBytesSync();
/// Signature/// static String encode(/// Uint8List data, {/// int componentX = 4,/// int componentY = 3,/// })/// may throw `BlurhashFFIException` if encoding fails.finalString blurHash = BlurhashFFI.encode(blurhashImageBytes);
// Or via codecfinalString blurHashSame = BlurhashFfiCodec().encoder.convert(blurhashImageBytes);
Decoding
Decoding now uses sync interface (without Future).
import'package:dart_blurhash_ffi/dart_blurhash_ffi.dart';
finalString blurhash = 'LGFO~6Yk^6#M@-5c,1Ex@@or[j6o';
/// Signature////// static Uint8List decode(/// String blurhash, {/// int width = 32,/// int height = 32,/// int punch = 1,/// })/// may throw `BlurhashFFIException` if decoding fails.final decoded = BlurhashFFI.decode(blurhash);
// or via codecfinalString decodedSame = BlurhashFfiCodec().decoder.convert(blurhash);