checkStatus method
Asks the printer whether it can take job (Android only; uses the
vendor/product id stored by connect). PrinterReadiness.unknown on
any error, timeout or other platform.
Implementation
Future<PrinterReadiness> checkStatus(List<int> job) async {
if (!Platform.isAndroid) return PrinterReadiness.unknown;
final q = PrinterStatusQuery.forJob(job);
try {
// Dynamic so this builds against drago_usb_printer versions that do
// not have queryStatus yet (NoSuchMethodError -> unknown).
final Uint8List? reply = await (usbPrinter as dynamic).queryStatus(
q.query,
timeout: const Duration(milliseconds: 1500),
) as Uint8List?;
return q.parse(reply);
} catch (_) {
return PrinterReadiness.unknown;
}
}