print method
Future<void>
print(
{ - required String address,
- ProgressCallback? onProgress,
- int addFeeds = 0,
- bool useImageRaster = false,
- bool keepConnected = false,
})
Implementation
Future<void> print({
required String address,
ProgressCallback? onProgress,
int addFeeds = 0,
bool useImageRaster = false,
bool keepConnected = false,
}) async {
int quality = 4;
final RenderRepaintBoundary boundary =
_localKey.currentContext!.findRenderObject() as RenderRepaintBoundary;
final image = await boundary.toImage(pixelRatio: quality.toDouble());
final byteData = await image.toByteData(format: ImageByteFormat.rawRgba);
final bytes = byteData!.buffer.asUint8List();
await FlutterBluetoothPrinter.printImage(
address: address,
imageBytes: bytes,
imageWidth: image.width,
imageHeight: image.height,
paperSize: _paperSize,
onProgress: onProgress,
addFeeds: addFeeds,
useImageRaster: useImageRaster,
keepConnected: keepConnected,
);
}