print method
Implementation
Future<void> print(List<int> textToPrint, BuildContext context,
void Function()? onPrintEnd) async {
connected = await PrintBluetoothThermal.connectionStatus;
if (connected != true) {
await loadFromLocalStorage();
}
if (connected == true) {
bool connectionStatus = await PrintBluetoothThermal.connectionStatus;
if (connectionStatus) {
await PrintBluetoothThermal.writeBytes(textToPrint);
if (onPrintEnd != null) onPrintEnd();
}
} else {
if (![null, ''].contains(printerWindowRoute)) {
Navigator.of(context).pushNamed(printerWindowRoute!, arguments: {
'tabIdx': 1,
'textToPrint': textToPrint,
'onPrintEnd': onPrintEnd
});
}
}
}