addStream method

Picture addStream(
  1. int topRow,
  2. int leftColumn,
  3. List<int> stream
)

Add styles to the collection

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

Implementation

Picture addStream(int topRow, int leftColumn, List<int> stream) {
  if (stream.isEmpty) {
    throw Exception('stream should not be null or empty');
  }

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