esc_pos_printer
esc_pos_printer copied to clipboard
Cannot print Image - The getter 'width' was called on null
I'm using: printer: EPSON TM-m30 esc_pos_printer: ^4.0.3
I'm trying to print an image using the following code:
import 'package:image/image.dart' as im;
final ByteData data = await image.toByteData();
Uint8List preImage = data.buffer.asUint8List();
im.Image img = im.decodeImage(preImage);
printer.image(img);
and it causes this error:
Unhandled Exception: NoSuchMethodError: The getter 'width' was called on null.
I've tried to do the following:
import 'package:image/image.dart' as im;
final ByteData data = await image.toByteData();
Uint8List preImage = data.buffer.asUint8List();
im.Image img = im.decodeImage(preImage);
im.Image thumbnail = im.copyResize(img, width: 80);
printer.image(thumbnail);
and still causes the same error.