flutter_web_bluetooth
1.2.0, released 5 weeks ago by dropmeirl.com
A Dart library to use the Web Bluetooth API in your projects.
What it does
Allows you to connect and interact with Bluetooth Low Energy devices from the browser. It compiles on native IO projects without conditional exports, though it only works in a browser.
AI-written summary of version 1.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are building a Flutter web or Dart project that needs to interact with Bluetooth devices.
- You want to share code across native and web platforms without conditional exports for Bluetooth.
Skip it when
- You need native Bluetooth support directly on IO platforms without a browser.
- The target browser does not support the experimental Web Bluetooth API.
Strengths
- Allows compiling on native platforms without throwing errors or requiring conditional exports.
- Supports modern Dart web features like wasm builds via `dart:js_interop`.
Weaknesses
- Does not actually function for Bluetooth operations outside of a browser.
- Requires experimental browser flags and secure contexts (HTTPS or localhost).
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 3
Requires a secure context (HTTPS or localhost) and enabling experimental web platform features in browsers like Chrome on Linux.
final supported = FlutterWebBluetooth.instance.isBluetoothApiSupported;
final available = FlutterWebBluetooth.instance.isAvailable;
final requestOptions = RequestOptionsBuilder.acceptAllDevices(optionalServices: [
BluetoothDefaultServiceUUIDS.deviceInformation.uuid
]);
try {
final device = await FlutterWebBluetooth.instance.requestDevice(requestOptions);
} on UserCancelledDialogError {
// The user cancelled the dialog
} on DeviceNotFoundError {
// There is no device in range
}Alternatives
Packages that do the same job and could replace flutter_web_bluetooth.
- win_ble
Bluetooth Low Energy plugin for Windows Flutter and pure‑Dart projects
50Compare - flutter_bluetooth_serial
Classical Bluetooth serial communication for Flutter on Android.
50Compare - bluetooth_enable_fork
Plugin to programmatically enable Bluetooth in Flutter apps
50Compare
Works with
Packages commonly used together with flutter_web_bluetooth: ones it builds on, ones built on it, and its own family.
- webflutter_web_bluetooth depends on itLightweight bindings for browser APIs via JS interop
- loggingflutter_web_bluetooth depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- universal_bleBuilt on flutter_web_bluetoothCross-platform Bluetooth Low Energy (BLE) plugin for Flutter