addBase64 method

Picture addBase64(
  1. int topRow,
  2. int leftColumn,
  3. String base64Data
)

Add styles to the collection

Workbook workbook = new Workbook();
Worksheet sheet = workbook.worksheets[0];
String base64Image = base64Encode(File('image.png').readAsBytesSync());
sheet.picutes.addBase64(1, 1, base64Image);
List<int> bytes = workbook.saveAsStream();
File('Picutes.xlsx').writeAsBytes(bytes);
workbook.dispose();

Implementation

Picture addBase64(int topRow, int leftColumn, String base64Data) {
  if (base64Data == '') {
    throw Exception('base64Data should not be null or empty');
  }

  final Picture picture = Picture(base64.decode(base64Data));
  picture.row = topRow;
  picture.column = leftColumn;
  _pictures.add(picture);
  return picture;
}