How to Convert BASE64 String into Image in Flutter

A Base64 string is a sequence of characters that represent data in an ASCII format. It is commonly used to encode data for transmission over the internet.

A Base64 image is an image that has been encoded using the Base64 encoding algorithm. The result is a string of letters and numbers that can be used to represent the image.

There are many reasons for converting an image into a Base64 string. It will be useful when you need to transfer binary data or store it in a database.

In order to convert a BASE64 String into an image, we have to use the Base64Decoder class from the dart:convert library. This class has a static method called decodeImage that takes a BASE64 String as input and returns an Image instance. We can use this image in our Flutter app like any other image.

//convert Base64 string to Uint8List
Uint8List image = Base64Decoder().convert(imageString);

Use Image.memeory() to display Uint8List file.

	height: 240,
	width: 240,
	child: FittedBox(
	  fit: BoxFit.cover,
	  child: Image.memory(
	    width: 240,
	    height: 240,

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.