[Feature]: Web Bluetooth Support
FlutterBluePlus Version
all
Flutter Version
all
What OS?
All
OS Version
Supported Chrome
Bluetooth Module
any
What is your feature request?
With Chrome ( behind flag ) supporting Web Bluetooth standard, This can be a great addition for Flutter Web Development.
If anyone is interested please let me know
Logs
Chrome Web BLE support:
https://developer.chrome.com/docs/capabilities/bluetooth?hl=en
Web Bluetooth W3C Spec:
https://webbluetoothcg.github.io/web-bluetooth/
feel free to open a PR!
Just some thoughts. To keep all the platform code similar, we should simulate the API of a platform channel, even though we don't actually need one.
in _invokeMethod
if (Platform.isWeb) {
out = await FlutterBluePlusWeb.invokeMethod(method, arguments);
} else {
out = await _methodChannel.invokeMethod(method, arguments);
}
in _initFlutterBluePlus
if (Platform.isWeb) {
FlutterBluePlusWeb.setMethodCallHandler(_methodCallHandler);
} else {
_methodChannel.setMethodCallHandler(_methodCallHandler);
}
I've started on web support: https://github.com/boskokg/flutter_blue_plus/compare/master...feature/web-bluetooth-support
I implemented startScan. It should be pretty straightforward to implement the rest, if someone wants to.
I implemented
startScan. It should be pretty straightforward to implement the rest, if someone wants to.
Hi @chipweinberger, thank you for your work on this package!
I hope you don't mind, I have implemented the web platform, based on your initial branch.
What is the recommended approach for testing the web implementation?
thats awesome. No recommended approach. Just try to test everything :)
your code looks good. I think stopScan should be a no-op, not unsupported.
also, please update the readme. etc.
your code looks good. I think stopScan should be a no-op, not unsupported.
also, please update the readme. etc.
Thank you for your feedback, I have refactored stopScan to be a no-op, and also updated the readme.
@tnc1997 recently created a PR for Web: https://github.com/chipweinberger/flutter_blue_plus/pull/964
However, FBP plans to remain Android/iOS/Mac only for the foreseeable future.
If you'd like to add web support, please do it via wrapper (example: https://pub.dev/packages/flutter_blue_plus_windows).
I'll keep this issue open until someone creates a wrapper for Web.