logo method
Insert image from asset (resize automatically)
assetPath: path in assets, e.g. 'assets/logo.png'
Replace existing logo(...) implementation with this one.
Expects charsPerLine, _generator, _bytes, and _preview to exist in the class.
Implementation
Future<void> logo(
Uint8List bytes, {
PosAlign align = PosAlign.center,
}) async {
try {
final image = img.decodeImage(bytes);
if (image == null) return;
// langsung kirim ke generator
_bytes.addAll(
_generator.image(
image,
align: align,
),
);
} catch (_) {
// silent fail → receipt tetap lanjut
}
}