Aus öffentlichen Paketdaten erstellte Orientierung.
OptimizedCachedImage ist ein Flutter-Paket, das entwickelt wurde, um Netzwerkbilder effizient zu laden, zu skalieren und zu zwischenspeichern, während der Speicherverbrauch minimiert wird. Es passt die Bildgröße automatisch an die Containerabmessungen an, wodurch unnötiger Speicherverbrauch verringert wird. Die Bibliothek sorgt für reibungslose Leistung durch Nutzung von Caching-Mechanismen und Optimierung der Ressourcenverwaltung. Ideal für Apps mit häufigem Bildladen, bietet sie ein Gleichgewicht aus Geschwindigkeit und Effizienz, ohne die Benutzererfahrung zu beeinträchtigen.
Anwendungsfälle
Dynamische Bilder von URLs laden
Bilder an Containerabmessungen anpassen
Bilder zwischenspeichern, um Netzwerk-Anfragen zu reduzieren
Verringern des Speicherverbrauchs in bildintensiven Apps
Verbesserung der App-Leistung durch effiziente Bildverarbeitung
Hauptmerkmale
Automatisches Bildgrößenändern
speicherplatzsparende Caching
Netzwerk-Bildladung
Containerbewusste Skalierung
Geringer Speicherbedarf
Geeignet für
Apps mit hohem Bildverkehr
leistungsrelevante Benutzeroberflächen
Mobile Apps mit begrenztem Speicher
Bildgalerien und Feeds
E-Commerce- oder Social-Media-Apps
Hinweise
Internetverbindung für den ersten Ladevorgang erforderlich
Möglicherweise ist eine Konfiguration für benutzerdefinierte Cache-Richtlinien erforderlich
Eingeschränkte plattformspezifische Optimierungen
Nicht geeignet für statische lokale Bilder
Abhängig von der Zuverlässigkeit des externen Netzwerks
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
Optimized Cached Image
❌❌ Important Update ❌❌
This library is no longer being maintained. When I started this library, it was meant to add memory performant extensions which could not be directly added into the parent library. Since then a lot has changed, the parent library has incorporated similar changes, perhaps with the exception of a trivial LayoutBuilder that auto detects image sizes. I feel like this is a good time to deprecate this library in favour of the parent.
Description
A flutter library for loading images from network, resizing and caching them for memory sensitivity.
This resizes and stores the images in cache based on parent container constraints and hence
loads images of lower size into memory. This is heavily inspired by cached_network_image library.
This library exposes two classes for loading images
OptimizedCacheImage which is a 1:1 mapping of CachedNetworkImage.
OptimizedCacheImageProvider which is a mapping of CachedNetworkImageProvider.
How to use
The OptimizedCacheImage can be used directly or through the ImageProvider.
Both the OptimizedCacheImage as OptimizedCacheImageProvider have minimal support for web. It currently doesn't include caching.
OCI uses Flutter Image Compress as the compression library, while being memory efficient this library doesn't provide out of box support for gifs, however it does allow compressing to webp. Hence all gifs are compressed to webp format beginning 2.0.2-alpha.
How it works
The optimized cached network images stores and retrieves files using the flutter_cache_manager.
FAQ
My app crashes when the image loading failed. (I know, this is not really a question.)
Does it really crash though? The debugger might pause, as the Dart VM doesn't recognize it as a caught exception; the console might print errors; even your crash reporting tool might report it (I know, that really sucks). However, does it really crash? Probably everything is just running fine. If you really get an app crashes you are fine to report an issue, but do that with a small example so we can reproduce that crash.