how to implement bluetooth to print via thermal printer on flutter web

Viewed 586

i am working on my client's app. it has a feature to print out from thermal printer via bluetooth on mobile app and web app. it is working on mobile app, but i saw that flutter_blue doesn't support web. how can i print on web via bluetooth?

my code to print via bluetooth on mobile app:

  initPrinter() async {
    // Start scanning
    StreamSubscription scanSubscription;
    await flutterBlue
        .startScan(timeout: Duration(seconds: 6))
        .asStream()
        .listen((event) {
      setState(() {
        results = event;
        print(results);
      });
    });
    await flutterBlue.scanResults.listen((event) {
      setState(() {
        results = event;
        print(results);
      });
    });
  }
1 Answers

I have faced similar problem where I want to print using a mobile thermal printer via bluetooth from my website on my tablet.

First, we have to know that browser cannot access bluetooth features on our phone/device.So we need something that can make a connection between a browser and device/tablet.The solution is an application.

Below is an app that can act as a bridge between our website and device so that we can access bluetooth to print from mobile thermal printer.

https://play.google.com/store/apps/details?id=mate.bluetoothprint

On this app, go to module called "Website/Browser Print".An explanation on how to open an app(bluetoothprint) from the browser on your tablet. Then you are able to print from a website and this app will open then connect to our mobile thermal printer and finally start printing.

Related