I'm facing a problem from the server I'm getting the image url data as a string. I need to save all these urls in the XFile format list. Tell me how can I convert the image url to XFile format?
I get

Try this:
static Future<XFile> getImageXFileByUrl(String url) async {
var file = await DefaultCacheManager().getSingleFile(url);
XFile result = await XFile(file.path);
return result;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With