image
image copied to clipboard
how to convert the package image to flutter default Image type?
Does anybody know how to do this without saving image into a file?
try this
Image.memory(im.encodePng(image))
Having the above code snippet in the top-level documentation/sample would have saved me a few hours of time.
Above code no longer worked for me because im.encodePng returns int list while Image.memory expects uintList. This minor modification works for me:
Image.memory(Uint8List.fromList(im.encodePng(rectifiedImage)))
You should also be able to typecast the returned type: Image.memory(im.encodePng(rectifiedImage) as Uint8List)
.
What is the opposite way, i.e. how to generate a package Image from default Image type?