Biblioteca de edição comunitária do Flutter para carregar e armazenar em cache imagens da rede. Também pode ser usada com widgets de espaço reservado e de erro.
Orientação gerada a partir de informações públicas. Apenas para referência.
Um pacote Flutter da edição comunitária para carregar e armazenar em cache imagens de rede de forma eficiente. Suporta placeholders durante o carregamento e widgets de erro quando a recuperação da imagem falha. Projetado para reduzir solicitações redundantes de rede e melhorar o desempenho armazenando imagens localmente. Compatível com múltiplas plataformas, incluindo Android, iOS, macOS, Windows e Linux. Ideal para aplicativos que exibem numerosas imagens remotas, como feeds de mídia social ou catálogos de produtos.
Casos de uso
Carregando imagens de URLs em listas
Exibindo espaço reservado enquanto a imagem carrega
Tratar falhas no carregamento de imagens com elegância
Armazenando em cache imagens para reduzir o uso de largura de banda
Melhorando o desempenho do aplicativo com armazenamento local de imagens
Principais recursos
Cache de imagem para melhor desempenho
Suporte para widgets de espaço reservado e erro
Compatibilidade multiplataforma
Gerenciamento eficiente de memória
API simples com opções personalizáveis
Indicado para
Aplicativos com carregamento frequente de imagens
Aplicativos de mídia social ou comércio eletrônico
Desenvolvedores procurando cache de imagem leve
Projetos que exigem interface do usuário confiável como alternativa
Equipes usando pacotes mantidos pela comunidade
Considerações
Requer permissão de internet em plataformas móveis
Pode consumir armazenamento do dispositivo com o tempo
Tamanho do cache não configurável no uso básico
Recursos limitados de controle avançado de cache
Depende de repositório externo para atualizações
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.