Answers for "how to cache network image with flutter"

3

cache network image flutter

cached_network_image: ^2.0.0 
            CachedNetworkImage(
                      imageUrl: yoururl,
                      errorWidget: (context, url, error) => Text("error"),
                      imageBuilder: (context, imageProvider) => CircleAvatar(
                        radius: 120,
                        backgroundImage: imageProvider,
                      ),
                      placeholder: (context, url) => CircularProgressIndicator(
                        backgroundColor: primary,
                      ),
                    ),
Posted by: Guest on May-26-2021
1

flutter cached network image not working

Worked for me after searching all over the sites :=>

1. Install the latest dependency for cached_network_image:
2. Stop and Restart the app if you are debugging or running

If not goahead with other steps:

3. Flutter clean
4. Quite from IDE
5. Reopen your IDE and run pub get

Example:

CachedNetworkImage(
   imageUrl: 'https://picsum.photos/250?image=9',
   fit: BoxFit.cover,
   width: MediaQuery.of(context).size.width,
   placeholder: (context,url) => CircularProgressIndicator(),
   errorWidget: (context,url,error) => new Icon(Icons.error),
 )
 
###### OR ######

Image(image: CachedNetworkImageProvider('https://picsum.photos/250?image=9'))
Posted by: Guest on May-01-2021

Code answers related to "how to cache network image with flutter"

Browse Popular Code Answers by Language