I am selecting on image from gallery then uploading it on server, after that on successful upload i am hitting one API to retrieve same image from server and want to show that image in the same ImageView I am using Image.file To load clicked image and Image.network To show Network image but i want One single thing to load image
Asked
Active
Viewed 878 times
1
-
please show me your code – Amon C Dec 26 '19 at 06:15
-
just set a boolen isImageUploaded, if it is true show Image.network widget else Image.asset image – Navin Kumar Dec 26 '19 at 06:36
-
i need one single function to load image, is there any library for this? – Sagar Dec 26 '19 at 06:43
-
in android studio we have picasso and Glide like that same library in flutter? – Sagar Dec 26 '19 at 06:47
-
try cachedImageNetwork, when url fails you can set from File – Navin Kumar Dec 26 '19 at 06:58
-
sorry but what i need is library or function to show image from URI and URL both in One – Sagar Dec 26 '19 at 07:11
-
Right now i am doing this -- child: _imageFile == null? Image.asset( 'assets/images/placeholder.png',) : Image.file(_imageFile), – Sagar Dec 26 '19 at 07:18
1 Answers
2
Try this, just set an boolen isProfileImageIsURL, if it is true show NetworkImage widget else FileImage
isProfileImageIsURL ? NetworkImage(profileImageURL) : FileImage(_profilePictureFile);

Navin Kumar
- 3,393
- 3
- 21
- 46
-
that's what i have replied above on your comment, i am using the same condition but i need single image loader for both the operations – Sagar Dec 26 '19 at 13:19
-
else load image from url and covert ad an file, then use in FileImage. – Navin Kumar Dec 26 '19 at 13:23
-