decodeBase64ToBytes function

Future<Uint8List> decodeBase64ToBytes(
  1. String base64Image
)

Implementation

Future<Uint8List> decodeBase64ToBytes(String base64Image) async {
  final bytes = base64Decode(base64Image);
  final codec = await instantiateImageCodec(bytes, targetWidth: 32);
  final frame = await codec.getNextFrame();
  final image = frame.image;

  final byteData = await image.toByteData(format: ImageByteFormat.png);
  return byteData!.buffer.asUint8List();
}