Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Web Bluetooth Support #769

Open
diegobes opened this issue Jan 22, 2024 · 8 comments
Open

[Feature]: Web Bluetooth Support #769

diegobes opened this issue Jan 22, 2024 · 8 comments
Labels
feature Feature request

Comments

@diegobes
Copy link

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/
@diegobes diegobes added the feature Feature request label Jan 22, 2024
@chipweinberger chipweinberger changed the title [Feature]: Add Support for Web Bluetooth W3C standard ( preliminary ) [Feature]: Web Bluetooth Support Jan 22, 2024
@chipweinberger
Copy link
Owner

feel free to open a PR!

@chipweinberger
Copy link
Owner

chipweinberger commented Feb 15, 2024

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);
}

@chipweinberger
Copy link
Owner

chipweinberger commented Apr 27, 2024

I've started on web support: master...feature/web-bluetooth-support

I implemented startScan. It should be pretty straightforward to implement the rest, if someone wants to.

@tnc1997
Copy link

tnc1997 commented Aug 12, 2024

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?

@chipweinberger
Copy link
Owner

thats awesome. No recommended approach. Just try to test everything :)

@chipweinberger
Copy link
Owner

chipweinberger commented Aug 12, 2024

your code looks good. I think stopScan should be a no-op, not unsupported.

also, please update the readme. etc.

@tnc1997
Copy link

tnc1997 commented Aug 13, 2024

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.

@chipweinberger
Copy link
Owner

chipweinberger commented Aug 29, 2024

@tnc1997 recently created a PR for Web: #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants