export method
Rasterise the editor's Exporter layers into a ui.Image. The exported size is the bounding union of every exporter's Exporter.exportSize.
Implementation
Future<ui.Image> export() async {
final exporters = layers.whereType<Exporter>().toList();
final recorder = ui.PictureRecorder();
final canvas = Canvas(recorder);
final size = exporters.fold<Size>(
Size.zero,
(acc, e) => Size(
acc.width > e.exportSize.width ? acc.width : e.exportSize.width,
acc.height > e.exportSize.height ? acc.height : e.exportSize.height,
),
);
for (final exp in exporters) {
exp.paintExport(canvas, size);
}
final picture = recorder.endRecording();
return picture.toImage(size.width.toInt(), size.height.toInt());
}