flutter_reactive_ble icon indicating copy to clipboard operation
flutter_reactive_ble copied to clipboard

Flutter Web support

Open realrk95 opened this issue 4 years ago • 10 comments

One of the biggest complaints from my customers is the inability to interop between operating systems. We design spectrometers which are used for medical analysis and quality control in pharma industry. Most of our current work is done in Flutter using this library. While this library is very stable for Android/iOS, targeting the web platform will make bluetooth support for Android, Windows, Mac and Linux. Also, since web is now stable, and so is the Web BLE spec on Chrome V8 (Used in Chrome, Edge, Brave, Opera etc.), I think this is the right time to do this.

I would be glad to help with creating a few pull requests which be sandboxed and tested on our/your devices. I'm not an expert programmer, but have enough knowledge to write the web interop and tests. My question is: If I do this, what is the chance that the plugin would be accepted by the community.

realrk95 avatar Mar 10 '21 16:03 realrk95

@realrk69 we are open to contributions from the community and expanding this library to other platforms is very interesting. Only thing is that we need to have enough ppl that can support maintaining the quality of this library on multiple platforms.

I think before we consider adding additional platforms let's first move to the federated plugin structure as described in: #128 . Now null-safety migration is done this will be the next step. If you need to have multiple platforms incorporated ASAP I would suggest to fork this repo.

So summary: yes we would love to have multiple platform support in this library given 2 preconditions:

  • We have a federated plugin structure in place
  • There is enough knowledge and support from the community to maintain this in order to guarantee the high quality and stability of this library.

remonh87 avatar Mar 10 '21 19:03 remonh87

@remonh87 Any update on federated structure? I have an implementation ready for web which I am currently writing tests for. I'm using BleStatus for indicating presence of support for BLE depending on browser support.

realrk95 avatar Jul 24 '21 20:07 realrk95

I have a basic structure in place but at the moment I focus on the new OS releases (especially android appears to be some work) .

remonh87 avatar Jul 25 '21 13:07 remonh87

Thanks for the update. Looking forward to whenever it becomes available.

realrk95 avatar Jul 25 '21 13:07 realrk95

@realrk95 the federated plugin structure is merged

remonh87 avatar Aug 17 '21 04:08 remonh87

Effectively speaking, there are two ways I can integrate the web support. One is using the native calls from dart to the browser with minimal JS interop. The other is using package:html which gives access to functionalities in the DOM. Which one would you recommend I use for the PR?

I've gone through the updated structure of the plugin and have a good idea of how to implement now, so will be creating the PR by the end of the week.

realrk95 avatar Aug 30 '21 06:08 realrk95

Hello @realrk95. Have you seen this project? I haven't used it myself, maybe you can leverage it instead of doing the plumbing from scratch.

mbabuglia avatar Aug 30 '21 13:08 mbabuglia

Hello @realrk95. Have you seen this project? I haven't used it myself, maybe you can leverage it instead of doing the plumbing from scratch.

Damn, I didn't know this. This is good. Thanks for letting me know

realrk95 avatar Aug 30 '21 13:08 realrk95

Effectively speaking, there are two ways I can integrate the web support. One is using the native calls from dart to the browser with minimal JS interop. The other is using package:html which gives access to functionalities in the DOM. Which one would you recommend I use for the PR?

I've gone through the updated structure of the plugin and have a good idea of how to implement now, so will be creating the PR by the end of the week.

I would recommend using the native calls from dart to the browser with minimal JS interop, happy to help on the implementation!

Taym95 avatar Aug 30 '21 15:08 Taym95

@realrk95 first awesome that you would like to implement a web ble plugin! About the approach: I personally prefer the approach suggested for linux support in: https://github.com/PhilipsHue/flutter_reactive_ble/pull/347 . Web bluetooth is a totally different cup of tea (not a lot of the maintainers of this library have deep knowledge about( and I would like that someone else can take care of the maintenance of the specific platform implementation so we can focus on the best experience for mobile.

you can also consider going for a non-endorsed plugin which we will promote here and can even incorporate it in the example app. We can also create a discussion on this GitHub page where we can go over the details

remonh87 avatar Aug 30 '21 15:08 remonh87