Orientação gerada a partir de informações públicas. Apenas para referência.
Um pacote de interface de plataforma para o CachedNetworkImage (Edição Comunitária) que permite carregamento de imagens entre plataformas com suporte a cache. Ele fornece uma API padronizada para buscar e exibir imagens da rede enquanto gerencia eficientemente a memória e o cache em disco no Android, iOS, Linux, macOS e Windows. Essa interface permite que os desenvolvedores estendam ou personalizem o comportamento de carregamento de imagens sem modificar a implementação principal. Foi projetada para ser usada por plugins ou pacotes que precisam se integrar à edição comunitária da funcionalidade de imagem de rede com cache.
Casos de uso
Carregando imagens de URLs com cache automático
Suporte a múltiplas plataformas em aplicativos com muitas imagens
Habilitar lógica personalizada de carregamento de imagem
Integração com plugins de processamento de imagem de terceiros
Criando componentes de interface reutilizáveis com exibição de imagem
Principais recursos
Compatibilidade multiplataforma
Cache eficiente em disco e memória
Interface de plataforma extensível
Suporta placeholders de imagem e tratamento de erros
Design leve e modular
Indicado para
Desenvolvedores de aplicativos multiplataforma em Flutter
Equipes mantendo soluções personalizadas de carregamento de imagens
Plugins que exigem comportamento consistente de busca de imagem
Aplicativos que precisam de desempenho otimizado de imagem
colaboradores de código aberto que expandem funcionalidades de imagem
Considerações
Requer integração com o pacote principal cached_network_image_ce
Limitado ao uso dentro do ecossistema da edição comunitária
Pode exigir configuração adicional para implementações personalizadas de plataforma
Não destinado ao uso direto no código do aplicativo
Depende das implementações específicas da plataforma subjacente
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
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.