imageFromBase64String function

Image imageFromBase64String(
  1. String base64String,
  2. BuildContext context,
  3. double? width,
  4. double? height,
)

Implementation

Image imageFromBase64String(
    String base64String, BuildContext context, double? width, double? height) {
  var decodedBase64 = base64String.replaceAll("\n", Constants.emptyString);
  Uint8List image = const Base64Decoder().convert(decodedBase64);
  return Image.memory(
    image,
    key: ValueKey<String>(base64String),
    width: width ?? MediaQuery.of(context).size.width * 0.60,
    height: height ?? MediaQuery.of(context).size.height * 0.4,
    fit: BoxFit.cover,
    gaplessPlayback: true,
  );
}