precached_network_image 1.0.0 precached_network_image: ^1.0.0 copied to clipboard
Flutter library to load and cache network images to disk and support to precache images to memory in advance to avoid the flash screen caused by the delay time.
Precached network image #
Flutter library to load and cache network images to disk and support to precache images to memory in advance to avoid the flash screen caused by the delay time.
Usage #
The PrecachedNetworkImage can be used directly.
PrecachedNetworkImage(
url: 'https://picsum.photos/200',
width: 200,
height: 200,
precache: true, // default is false, true for next time loading from memory in advance.
placeholder: Image.asset(
"assets/images/default.png",
fit: BoxFit.fill,
),
),
When you want to precache images to memory to avoid the delay time, you can call PrecachedNetworkImageManager's precacheNetworkImages() which read the disk's files to memory like on the launch widget in advance.
@override
void initState() {
super.initState();
PrecachedNetworkImageManager.instance.precacheNetworkImages();
}
Author #
Visit my github: janlionly
Contact with me by email: janlionly@gmail.com
Contribute #
I would love you to contribute to PrecachedNetworkImage
License #
PrecachedNetworkImage is available under the MIT license. See the LICENSE file for more info.