Flutter Image.network is not showing when using loadingBuilder? Flutter Image.network is not showing when using loadingBuilder? dart dart

Flutter Image.network is not showing when using loadingBuilder?


Use CachedNetworkImage which loads the image and provide error and loading widgets.

dependencies:  cached_network_image: ^2.3.3

Code:

CachedNetworkImage(  imageUrl: "http://via.placeholder.com/200x150",  imageBuilder: (context, imageProvider) => Container(    decoration: BoxDecoration(      image: DecorationImage(          image: imageProvider,          fit: BoxFit.cover,          colorFilter:              ColorFilter.mode(Colors.red, BlendMode.colorBurn)),    ),  ),  placeholder: (context, url) => CircularProgressIndicator(),  errorWidget: (context, url, error) => Icon(Icons.error),),


Returning child from loadingBuilder when loadingProgress is null will work.Sample:

loadingBuilder: (context, child, loadingProgress) {        if(loadingProgress == null)          return child;        return Center(          child: CircularProgressIndicator(            value: (loadingProgress != null)                ? (loadingProgress.cumulativeBytesLoaded /                    loadingProgress.expectedTotalBytes)                : 0,          ),        );      },