printSingleBitmap method

  1. @override
Future<void> printSingleBitmap(
  1. dynamic img, {
  2. IminPictureStyle? pictureStyle,
})
override

Implementation

@override
Future<void> printSingleBitmap(dynamic img,
    {IminPictureStyle? pictureStyle}) async {
  Map<String, dynamic> arguments = <String, dynamic>{};
  if (pictureStyle != null) {
    if (pictureStyle.alignment != null) {
      arguments.putIfAbsent("alignment", () => pictureStyle.alignment?.index);
    }
    if (pictureStyle.width != null && pictureStyle.height != null) {
      arguments.putIfAbsent("width", () => pictureStyle.width);
      arguments.putIfAbsent("height", () => pictureStyle.height);
    }
  }
  arguments.putIfAbsent("bitmap", () => img);
  if (img is Uint8List) {
    await methodChannel.invokeMethod<void>('printSingleBitmap', arguments);
  } else {
    await methodChannel.invokeMethod<void>('printBitmapToUrl', arguments);
  }
}