Convert BASE64 String into Image in Flutter

Some backend systems save image as BASE64 string instead of its URL. Here is how to convert it into an image in Flutter.

Convert BASE64 to image

Uint8List _image = Base64Decoder().convert(product.image);

Display it with Image.memory

Container(
            height: 80,
            width: 80,
            child: FittedBox(
              fit: BoxFit.cover,
              child: Image.memory(
                _image,
                width: 80,
                height: 80,
              ),
            ),
          )

Leave a Comment

Your email address will not be published. Required fields are marked *

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close