printSingleBitmapBlackWhite method

  1. @override
Future<void> printSingleBitmapBlackWhite(
  1. dynamic img, {
  2. IminBaseStyle? baseStyle,
})
override

Implementation

@override
Future<void> printSingleBitmapBlackWhite(dynamic img,
    {IminBaseStyle? baseStyle}) async {
  Map<String, dynamic> arguments = <String, dynamic>{};
  if (baseStyle != null) {
    if (baseStyle.width != null && baseStyle.height != null) {
      arguments.putIfAbsent("width", () => baseStyle.width);
      arguments.putIfAbsent("height", () => baseStyle.height);
    }
  }
  arguments.putIfAbsent("bitmap", () => img);
  if (img is Uint8List) {
    await methodChannel.invokeMethod<void>(
        'printSingleBitmapBlackWhite', arguments);
  } else {
    arguments.putIfAbsent("blackWhite", () => 1);
    await methodChannel.invokeMethod<void>('printBitmapToUrl', arguments);
  }
}