I am using mac os for flutter. network image is not displayed. it gives an error.
I have tried on both android and iOS emulators.
Code:
CircleAvatar(
radius: 40,
backgroundImage: NetworkImage(
"https://en.wikipedia.org/wiki/Emma_Watson#/media/File:Emma_Watson_2013.jpg"),
),
Output:
flutter:
════════ Exception caught by image resource service ════════════════════════════
The following _Exception was thrown resolving an image codec:
Exception: Invalid image data
>Solution :
Your url is pointing to image in WebView. You need to specify exact image resource link
Try with this link: https://upload.wikimedia.org/wikipedia/commons/7/7f/Emma_Watson_2013.jpg
To get exact image resource path, right Click on Image and Click on Copy Image Address
Try this code:
CircleAvatar(
radius: 40,
backgroundImage: NetworkImage("https://upload.wikimedia.org/wikipedia/commons/7/7f/Emma_Watson_2013.jpg"),
),