XFile.writeAsBytesSync method

Viewed 328

I copied some code from the web and I had these lines

File image;
...
image.writeAsBytesSync(result);

But I had to change image type to XFile. Is there a way to do the same operation with XFile class?

1 Answers

A simple work-around like this will work:

XFile image;
...
File file = File(image.path);
file.writeAsBytesSync(result);
image = XFile(file.path);
Related