bluetooth_flutter 0.0.1 copy "bluetooth_flutter: ^0.0.1" to clipboard
bluetooth_flutter: ^0.0.1 copied to clipboard

Cross-platform Bluetooth Low Energy for Flutter. Integrates the bluetooth_dart package and uses cargokit to build the native Rust (btleplug) library and reach it via FFI.

bluetooth_flutter #

Cross-platform Bluetooth Low Energy for Flutter. Builds the native bluetooth_core (Rust / btleplug) library automatically via cargokit and re-exports the full bluetooth_dart API.

Usage #

import 'package:bluetooth_flutter/bluetooth_flutter.dart';

await BluetoothFlutter.ensureInitialized();
if ((await Bluetooth.instance.requestPermission()).isUsable) {
  final scan = await Bluetooth.instance.startScan();
  scan.devices.listen((d) => debugPrint('$d'));
}

Platform setup #

The plugin builds and bundles the native library for you; you still declare the Bluetooth permission in your app:

  • macOS and iOS: add NSBluetoothAlwaysUsageDescription to Info.plist. On macOS (sandboxed) also enable the com.apple.security.device.bluetooth entitlement.
  • Android: request the scan permissions at runtime before scanning: BLUETOOTH_SCAN and BLUETOOTH_CONNECT on API 31+, or ACCESS_FINE_LOCATION (with location services enabled) on API 30 and below. The plugin manifest declares all three and bundles btleplug's droidplug Java/JNI companion; the example requests them with permission_handler.

Building requires Rust (until precompiled binaries are published).

Status #

Host Status
macOS Tested
Ubuntu 24.04 Tested
Android Tested
iOS Untested
iOS Simulator Untested
Android Emulator Untested
Windows 11 Untested
Web Untested

macOS, Ubuntu 24.04, and Android are tested.

Web support comes from bluetooth_dart's Web Bluetooth backend directly and does not require the Flutter plugin's native library.

1
likes
160
points
122
downloads

Documentation

API reference

Publisher

verified publishermanymath.com

Weekly Downloads

Cross-platform Bluetooth Low Energy for Flutter. Integrates the bluetooth_dart package and uses cargokit to build the native Rust (btleplug) library and reach it via FFI.

Repository (GitHub)
View/report issues

Topics

#bluetooth #ble #btleplug #ffi

License

MIT (license)

Dependencies

bluetooth_dart, flutter

More

Packages that depend on bluetooth_flutter

Packages that implement bluetooth_flutter