Uint8List to file

716 Views Asked by At

I want to convert and upload signature image to rest server and how to be able to upload to the rest server. I try convert to file but i get this error here is my code

log error

2

There are 2 best solutions below

0
On

To upload uint8List to REST server you can do it with

MultipartFile.fromBytes(String field, List<int> value, {String? filename, MediaType? contentType})

To know more : visit here

2
On

You can try this to show in the widget

Image.memory(your_uin8listBytes)

or

MemoryImage(your_uin8listBytes)

If you are sending the uin8list to firebase storage you can use

putData(your_uin8listBytes)

instead of

putFile(File)

and set metadata

 SettableMetadata(contentType: 'image/$fileType')