printBytes method
Implementation
Future<void> printBytes({
required Uint8List bytes,
void Function(int total, int progress)? progress,
}) async {
final completer = Completer<bool>();
StreamSubscription? listener;
listener = _plugin._printingProgress.stream.listen((event) {
final int t = event['total'];
final int p = event['progress'];
if (progress != null) {
progress(t, p);
}
if (t == p) {
listener?.cancel();
if (!completer.isCompleted) {
completer.complete(true);
}
}
});
await _plugin._channel.invokeMethod(
'print',
bytes,
);
await completer.future;
}