I had to read my image source from base64 to flutter Image object.
Image img = Image.memory(base64Decode(BASE64_STRING));
and then i wanted to put the image as a Container background. But DecorationImage is only accepting ImageProvider.
How to convert Image to ImageProvider? or is ther any other way to deliver base64 image to ImageProvider?
Container(
decoration: BoxDecoration(
color: Colors.green,
image: DecorationImage(
image: img // <-- Expecting ImageProvider
)
)
Call .image
on your ImageProvider.
In your case:
Container(
decoration: BoxDecoration(
color: Colors.green,
image: DecorationImage(
image: img.image // <--- .image added here
)
)