Flutter library To add Bluetooth Low Energy Support in WebView Flutter
Using flutter_inappwebview for WebView and flutter_reactive_ble for bluetooth
Import these Libraries in your pubspec.yaml
flutter_inappwebview: ^5.4.3+7
web_view_ble: 0.0.4
Add WebView in your Project , Check flutter_inappwebview docs for setting up WebView
And check flutter_reactive_ble docs for adding bluetooth related settings in your native projects
in your onLoadStop
callback of flutter_inappwebview , add this method
void onLoadStop(InAppWebViewController controller,BuildContext context) async {
WebViewBle.init(controller: controller, context: context);
}
Checkout /example for more details
The web_view_ble lib supports the following bluetooth Api's:
- Request Device (Filters : ServiceId , name , namePrefix)
- Connect
- Disconnect
- Discover services
- Discover characteristics
- Read / write a characteristic
- Subscribe / unsubscribe to a characteristic
Thanks to WebBle for Ble javascript Polyfill
This is Just The Initial Version feel free to Contribute or Report any Bug!