I need to get the file size of the image that is a network image. I mean size in Kb, Mb, etc. How can I get it?
Asked
Active
Viewed 553 times
0
-
refer this https://stackoverflow.com/questions/44665955/how-do-i-determine-the-width-and-height-of-an-image-in-flutter – Ravindra S. Patil Apr 20 '22 at 07:13
1 Answers
3
You can get the size of the network Image by HTTP head request.
http.Response r = await http.head(Uri.parse('https://i.stack.imgur.com/lkd0a.png'));
print(r.headers["content-length"]); //545621 means 546 KB

Kishan Busa
- 821
- 6
- 14