An image loading and caching library for flutter focused on speed and memory efficiency.
Supports iOS and Android.
Dalí saves the downloaded image in memory in case the same image is requested in the future. Only a resized version with the desired size will be loaded in memory instead of loading the full size in order to preserve RAM memory.
Images are also saved in the cache directory of the app.
Use the Dali widget
The easier way is to use the Dali widget. It will get the dimensions of his container and load a resized image
Container( height: 200, width: 200, child: Dali( 'https://homepages.cae.wisc.edu/~ece533/images/airplane.png', ), )
You have the option to set a loading widget while the image is being loaded, and also an error widget if it occurs
Dali( imageUrl: 'https://homepages.cae.wisc.edu/~ece533/images/airplane.png', fit: BoxFit.cover, placeholder: Icon(Icons.timer), errorWidget: Icon(Icons.error), )
Use the DaliImageProvider
Alternatively you can use the DaliImageProvider in combination with the Image widget
Image( image: DaliImageProvider( 'https://homepages.cae.wisc.edu/~ece533/images/airplane.png', width: 90, height: 90, ), fit: BoxFit.cover, )
Remember it is always better to set the width and height of the image
- Built-in types and core primitives for a Flutter application. [...]
- Support for asynchronous programming, with classes such as Future and Stream. [...]
- Classes and utilities that supplement the collection support in dart:core. [...]
- Encoders and decoders for converting between different data representations, including JSON and UTF-8. [...]
- Built-in types, collections, and other core functionality for every Dart program. [...]
- Interact with developer tools such as the debugger and inspector. [...]
- Mathematical constants and functions, plus a random number generator. [...]
- Lists that efficiently handle fixed sized data (for example, unsigned 8 byte integers) and SIMD numeric types. [...]
- File, socket, HTTP, and other I/O support for non-web applications. [...]
- Concurrent programming using isolates: independent workers that are similar to threads but don't share memory, communicating only via messages. [...]