When I try to show an image to the user it cannot be seen.
Image.network('https://picsum.photos/250?image=9')
I've tried adding
<uses-permission android:name="android.permission.INTERNET" />
to the AndroidManifest.xml file.
Still not displaying.
I have not tried this with IOS.
Also I've realised I'm getting an error as follows:
The following SocketException was thrown resolving an image codec: 'picsum.photos' (OS Error: No address associated with host.
Any idea on how I could fix this?
Edit 1:
this is the code for that I'm using:
CachedNetworkImage(
imageUrl: '$server/cdn/post/img?id=${this.id}', httpHeaders: imgHeaders,
placeholder: (BuildContext context, String url) {
return Center(child: CircularProgressIndicator());
},
errorWidget: (context, url, error) => Icon(Icons.error),
),
The server is my localhost url and it works fine as I am using it to fetch some data from my nodejs server and it works.
this.id is my widget's argument which is equal to an id that server will use to serve the correct image. It is defined and has a value.
Also this is a child of a Stack widget if that helps. Plus I've had this with other urls as well.