सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
CachedNetworkImage (समुदाय संस्करण) के लिए एक प्लेटफॉर्म इंटरफ़ेस पैकेज जो क्रॉस-प्लेटफॉर्म छवि लोडिंग के साथ कैशिंग समर्थन प्रदान करता है। यह मेमोरी और डिस्क कैश को एंड्रॉइड, आईओएस, लिनक्स, मैकओएस और विंडोज पर कुशलता से प्रबंधित करते हुए नेटवर्क छवियों को खोजने और प्रदर्शित करने के लिए एक मानकीकृत API प्रदान करता है। इस इंटरफ़ेस के माध्यम से विकासकर्ता को मूल कार्यान्वयन को संशोधित किए बिना छवि लोडिंग व्यवहार को विस्तारित या कस्टमाइज़ करने की अनुमति मिलती है। यह ऐसे प्लगइन या पैकेज के लिए डिज़ाइन किया गया है जिन्हें कैशिंग नेटवर्क इमेज के समुदाय संस्करण के साथ एकीकृत करने की आवश्यकता होती है।
उपयोग
URL से छवियाँ लोड करें और स्वचालित कैशिंग करें
चित्र-भारी ऐप्स में कई प्लेटफॉर्म का समर्थन करना
कस्टम छवि लोडिंग तरीके को सक्षम करना
तीसरे पक्ष के छवि संसाधन प्लगइन के साथ एकीकरण
चित्र प्रदर्शन के साथ पुन: उपयोगी UI घटक बनाना
मुख्य विशेषताएँ
क्रॉस-प्लेटफॉर्म संगतता
कुशल डिस्क और मेमोरी कैशिंग
विस्तारयोग्य प्लेटफॉर्म इंटरफेस
चित्र स्थानाभाव और त्रुटि प्रबंधन का समर्थन करता है
हल्का और मॉड्यूलर डिज़ाइन
इनके लिए उपयुक्त
बहु-प्लेटफॉर्म फ्लटर ऐप्स बनाने वाले डेवलपर्स
कस्टम छवि लोडिंग समाधान बनाए रखने वाली टीमें
स्थिर छवि प्राप्ति व्यवहार की आवश्यकता वाले प्लगइन
अनुप्रयोग जिनके लिए चित्र प्रदर्शन में अनुकूलन की आवश्यकता है
छवि कार्यक्षमता के विस्तार करने वाले ओपन-सोर्स योगदानकर्ता
विचार योग्य बातें
मुख्य cached_network_image_ce पैकेज के साथ एकीकरण की आवश्यकता है
समुदाय संस्करण प्रणाली के भीतर ही उपयोग के लिए सीमित
कस्टम प्लेटफॉर्म इम्प्लीमेंटेशन के लिए अतिरिक्त सेटअप की आवश्यकता हो सकती है
एप्लिकेशन कोड में सीधे उपयोग के लिए नहीं बनाया गया है
नीचे के प्लेटफॉर्म-विशिष्ट कार्यान्वयन पर निर्भर करता है
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
Zero-jank image caching for Flutter
cached_network_image_ce is the actively maintained fork of
cached_network_image,
rebuilt around a caching engine that doesn't block your UI thread. Same widget and provider API you already use.
cached_network_image by Baseflow is one of the most widely used packages in the Flutter ecosystem. It has also been effectively unmaintained since August 2024, sitting on 300+ open issues, including memory leaks and scroll-performance bugs that never got fixed.
Under the hood it leans on sqflite for cache metadata: a full SQL engine routed through a platform channel just to answer "have I already downloaded this image?" On image-heavy lists, that overhead shows up as jank you can feel.
We didn't fork this just to merge dependabot PRs. We rebuilt the caching layer.
We swapped sqflite for hive_ce, a pure-Dart, non-blocking key-value store. It skips the platform channel round trip and the SQL parser entirely, so there's no jank left to fix.
How we stack up
vs. the original cached_network_image:
Original (cached_network_image)
This fork (cached_network_image_ce)
Cache backend
sqflite (platform channel)
✅ hive_ce (pure Dart)
Maintenance
❌ stale since Aug 2024
✅ active, regular releases
Web caching
⚠️ browser cache only
✅ full persistent IndexedDB cache
HTTP / cache interceptors
❌
✅ full chains (auth, logging, custom responses)
Cache eviction
❌ fixed
✅ pluggable — TTL or LRU
Cache read (10 KB)
16 ms
✅ 2 ms — 8x faster
Unsupported formats (SVG/AVIF/HEIC)
❌ opaque decode error
✅ unsupportedImageBuilder hook
vs. other popular alternatives, checked live against pub.dev, so this is current rather than a guess:
Package
Cache backend
Web support
Interceptors
Cleanup strategy
Maintenance
cached_network_image_ce (this)
hive_ce
✅ full IndexedDB
✅ HTTP + cache
✅ TTL / LRU
✅ active
cached_network_image
sqflite
⚠️ browser only
❌
❌ fixed
❌ stale
flutter_cache_manager
sqflite / plain JSON
✅
❌
❌ fixed
✅ active
extended_image
undisclosed
✅
⚠️ headers/retry only
⚠️ manual clear
✅ active
fast_cached_network_image
hive (plain)
✅ (claimed)
❌
⚠️ TTL only
⚠️ stale (17mo)
Worth saying plainly: flutter_cache_manager and extended_image are both actively maintained by reputable teams. They're solving different problems than we are: a generic file cache, and a broad image/gesture toolkit, respectively. The "actively maintained fork" pitch applies specifically against the original cached_network_image, which this package is a drop-in replacement for.
Architecture
flowchart LR
W[CachedNetworkImage widget] --> P[CachedNetworkImageProvider]
P --> M[DefaultCacheManager]
M --> H[("Hive CE<br/>metadata: URL, path,<br/>validTill, eTag")]
M --> FS[("Native filesystem<br/>raw image bytes")]
H -.cache hit.-> P
FS -.cache hit.-> P
subgraph Original[Original package, for comparison]
direction LR
W2[CachedNetworkImage] --> M2[CacheManager]
M2 --> PC[Platform Channel]
PC --> SQL[(SQLite via sqflite)]
end
The quick start above covers the basics. For interceptors, cleanup strategies, connection timeouts, custom cache and metadata directories, web render modes, and unsupported-format handling, see the full reference:
Q: Will I lose my users' existing cache if I migrate?
A: Yes. Because we switched the storage engine from SQLite to Hive, the old cache files will be ignored. Users will re-download images once as they browse. This is a one-time migration cost for a permanent performance gain.
Q: My app crashes/pauses on errors?
A: In Debug mode, Flutter may pause on exceptions even if they are caught. This is expected behavior for network errors (404s). In Release mode, these are handled silently by the errorWidget.
Q: Why is web caching slower, or why does it use Hive for image bytes?
A: On Mobile & Desktop (IO), this package stores image bytes directly on the native file system and uses Hive only for metadata. Web lacks a native file system, so hive_ce stores both metadata and image bytes in IndexedDB there. Serializing large byte arrays in and out of IndexedDB carries overhead that doesn't exist on IO.
Alternative: if persistent caching across sessions isn't critical for your web users, consider conditionally using Image.network on web, which relies on the browser's built-in caching.
Contributing
We welcome contributions! If you want to help maintain this package, check CONTRIBUTING.md.