ble_peripheral_plus
2.5.4, released 6 months ago by almasum.dev
Flutter plugin for BLE peripheral/GATT server on Android, iOS, macOS, and Windows
What it does
Provides APIs to create BLE peripherals, add services and characteristics, advertise, and handle read/write/subscribe callbacks. It supports dynamic service management and client tracking. The plugin is a maintained fork of ble_peripheral with added Android bonding and subscription utilities.
AI-written summary of version 2.5.4, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to expose BLE services from a Flutter app
- You require dynamic service addition/removal at runtime
- You need to track subscribed clients and update characteristics per client
Skip it when
- You only need BLE central functionality
- Your target platform is Linux
- You want a lightweight library without platform permissions
Strengths
- Cross‑platform support (Android, iOS, macOS, Windows)
- Maintained fork with bug fixes and newer Flutter compatibility
- Adds getSubscribedClients() and Android requireBonding support
- Keeps original API for easy migration
Weaknesses
- No Linux support
- Requires platform‑specific permissions and Info.plist entries
- Setup involves multiple native permission steps
Setup
- Kind
- Plugin (native code)
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 0
Android: add BLUETOOTH, BLUETOOTH_ADMIN, BLUETOOTH_CONNECT, BLUETOOTH_ADVERTISE, BLUETOOTH_SCAN permissions and request runtime permissions. iOS/macOS: add NSBluetoothAlwaysUsageDescription to Info.plist and enable Bluetooth capability on macOS. Windows: no extra setup beyond normal Bluetooth availability.
import 'package:ble_peripheral_plus/ble_peripheral_plus.dart';
Future<void> startPeripheral() async {
await BlePeripheral.initialize();
if (!await BlePeripheral.isSupported()) throw Exception('Not supported');
await BlePeripheral.clearServices();
await BlePeripheral.addService(
BleService(
uuid: '0000180F-0000-1000-8000-00805F9B34FB',
primary: true,
characteristics: [
BleCharacteristic(
uuid: '00002A19-0000-1000-8000-00805F9B34FB',
properties: [CharacteristicProperties.read.index, CharacteristicProperties.notify.index],
permissions: [AttributePermissions.readable.index],
value: Uint8List.fromList([100]),
),
],
),
);
await BlePeripheral.startAdvertising(
services: ['0000180F-0000-1000-8000-00805F9B34FB'],
localName: 'Battery',
requireBonding: true,
);
}Alternatives
Packages that do the same job and could replace ble_peripheral_plus.
- universal_ble
Cross-platform Bluetooth Low Energy (BLE) plugin for Flutter
92Compare - flutter_reactive_ble
Reactive BLE plugin for Android and iOS that supports multiple devices
86Compare - vital_bluetooth
Bluetooth LE plugin for Flutter with background support and automatic reconnect
66Compare - bluetooth_low_energy
A Flutter plugin for controlling Bluetooth Low Energy, supporting central and peripheral roles.
64Compare