Why CachedNetworkImage when receiving wrong url by error?

114 Views Asked by At

I have to display images that are first entered by the user via a form in which he must enter the relative Url, so I can't know if he will enter a correct Url. I tried to handle the error with the errorWidget property of the CachedNetworkImage but it doesn't work.

    CachedNetworkImage(
                                                          
  width: larghezza / 5,
 imageUrl:
 "test",
 progressIndicatorBuilder: (context, url, downloadProgress) =>
LinearProgressIndicator(
 color: Colors.black,
   backgroundColor:
          Colors.blue[50],
    value:
      downloadProgress.progress),
 errorWidget:
 (context, url, error) =>
Icon(Icons.error),
 ),

The error I get is this:

ArgumentError (Invalid argument(s): No host specified in URI s)
0

There are 0 best solutions below