'Flutter BluetoothPort connection device is lost
I tried to print pdf from Flutter app in Zebra ZQ620 by bluetooth. But I get a problem, it seems that I lost Bluetooth port connection. I use Flutter Bluetooth_print package. In my print_page.dart
@override
void initState() {
super.initState();
WidgetsBinding.instance!.addPostFrameCallback((_) => {initPrinter()});
}
Future<void> initPrinter() async {
bluetoothPrint.startScan(timeout: Duration(seconds: 3));
if (!mounted) return;
bluetoothPrint.scanResults.listen(
(val) {
if (!mounted) return;
setState(() => {_devices = val});
if (_devices.isEmpty)
setState(() {
_devicesMsg = "No Devices";
});
},
);
}
I successfully retrieve devices printer list. But when I tried to print, I lost connection. So please, I need help to fix it or if someone could give me an advice about another Flutter's package. I have to run into Ipad. I already tried with esc_pos_bluetooth and blue_print but it's just Bluetooth_print that seems to be what I need. Thank's !
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|