flutter_ble_peripheral 3.0.0
flutter_ble_peripheral: ^3.0.0 copied to clipboard
This plugin enables a device to be set into peripheral mode, and advertise custom services and characteristics.
Changelog #
3.0.0 - 2026-09-02 #
⚠ BREAKING CHANGES #
Advertising was split into a shared core plus one settings object per platform, so a call site no longer mixes fields that only one platform honours with fields every platform honours. The README has the full before/after.
AdvertiseDatais removed. UseAdvertiseDataCorefor the cross-platform fields orAndroidAdvertiseDatafor the Android-only ones, andincludeTxPowerLevelin place ofincludePowerLevel(#301, #314)start(advertiseSettings:),start(advertiseSetParameters:),start(advertiseResponseData:),start(advertisePeriodicData:)andstart(periodicAdvertiseSettings:)are removed. Passstart(androidSettings: AndroidAdvertiseSettings(...)), which holds all five;advertisePeriodicDataisperiodicAdvertiseDatathere.DarwinAdvertiseSettingsandWindowsAdvertiseSettingsare the equivalents for the other platforms (#301)AdvertiseSettings.advertiseSetis removed. PassingAndroidAdvertiseSettings.advertiseSetParametersselects the extended advertising API, and is now mutually exclusive withadvertiseSettings, where 2.x took both and letadvertiseSetpick (#301)PermissionStateis removed. UsePeripheralBluetoothState, which covers the same permission cases plus the adapter states. There is deliberately no alias: the two declare their entries in a different order and the values cross the platform channel by ordinal, so mapping the old values across by index would give the wrong state rather than a compile error (#301)BluetoothPeripheralStateis renamed toPeripheralBluetoothState, so this package andflutter_ble_centralno longer declare colliding type names. The old name stays as a deprecated alias in 3.0 and is removed in the next breaking release (#316)AdvertiseSettingsdefaults changed:timeoutis0, meaning no timeout, instead of400, andtxPowerLevelisadvertiseTxPowerHighinstead ofadvertiseTxPowerLow(#301)AdvertiseSetParameters.anonymousis abool?, not anint?(#289)PeripheralStatecarrieslocationServicesDisabledagain, which shifts the index of every entry after it. Switch on the values, not on.values[i](#301)- The files under
lib/srcmoved intocore/andplatform/<platform>/. Only a directpackage:flutter_ble_peripheral/src/...import breaks; everything is still exported frompackage:flutter_ble_peripheral/flutter_ble_peripheral.dart(#301)
Features #
- add a gatt server with tx and rx characteristics (#260) (bea5601)
- windows: serve a gatt server with tx and rx characteristics (#302) (fe76ede)
- split the advertising api into core and per-platform settings (#301) (b88abee)
- remove the deprecated AdvertiseData (#314) (26fcfdb)
- keep the old state name as a deprecated alias (#316) (dc3c389)
- honour the advertise timeout on windows (#299) (0260ef8)
- add the peripheral half of the interop harness (#308) (90e2e10)
- rebuild the example app and add pong over the gatt link (#311) (67cdff0)
Bug Fixes #
- android service uuids not broadcasting (#285) (b107d15)
- apply tx power flags and send periodic advertise data on android (#293) (079274c)
- read advertise byte payloads without casting to ByteArray (#287) (4832965)
- send the android advertising results from the main thread (#300) (776aa4a)
- set advertiseResponseData correctly on Android (#269) (0e84738)
- apple: report peripheral support from core bluetooth, not beacon monitoring (#309) (76e6405)
- apple: report the att mtu rather than the notification payload size (#304) (adfa9d7)
- validate service uuids and advertise once powered on, on apple (#290) (3135668)
- build the full advertisement payload on windows (#297) (881ed5b)
- correct the windows state reporting and plugin teardown (#298) (20b81c9)
- windows: align the peripheral state values with the dart enum (#303) (01e65aa)
- windows: stop a failed radio read from taking the process down (#307) (0c819cd)
- windows: wait for the radio lookup before answering isSupported (#310) (16d8c3a)
- keep isAdvertising true while a central is connected (#305) (ffe46b4)
- only offer a local name where the platform broadcasts one (#312) (11ea402)
- return the advertising state from start on every platform (#292) (3f0be35)
- return the converted map from Uint8ListMapStringConverter.toJson (#295) (6473056)
- type AdvertiseSetParameters.anonymous as a bool (#289) (612ec8d)
- example: defer link meter reports made while the tree is locked (#313) (fab6ddc)
2.1.1 #
Fixes #
- [Windows] Fixed crash when Bluetooth adapter is not present or Bluetooth is disabled
- [Windows] Added comprehensive exception handling throughout the plugin to prevent crashes from WinRT API failures
- [Windows] Fixed initial state reporting to correctly show
unsupportedwhen no Bluetooth adapter is available - [Windows] Fixed potential crash from type mismatches in method call arguments
2.1.0 #
New Features #
- [iOS/macOS] Added
isBluetoothOnto check Bluetooth power state - [iOS/macOS] Added
hasPermissionusingCBPeripheralManager.authorizationAPI - [iOS/macOS] Added
requestPermissionsupport (returns current state, as permissions are implicit on Apple) - [iOS/macOS] Added
openBluetoothSettingsthat opens Bluetooth settings directly - [Android] Added
isBluetoothOnto check Bluetooth power state - [Android] Added Bluetooth state change listener - UI now updates when Bluetooth is toggled while app is open
- [Dart]
hasPermission()andrequestPermission()now work on iOS/macOS (previously returnedunknown)
Improvements #
- [iOS/macOS]
isSupportednow uses peripheral manager state instead of iBeacon check - [iOS/macOS] Permission and Bluetooth state are now properly separated (permission can be checked regardless of power state)
- [Example] Complete redesign with Material 3 UI
- [Example] Added comprehensive startup checks for: BLE support, permissions, Bluetooth state
- [Example] Platform-specific permission dialogs (Apple shows Settings only, Android shows Grant button)
- [Example] Android permission dialog updates when permanently denied
- [Example] Bluetooth off dialog hides "Turn On" button on Apple (not supported)
- [Windows] Updated build configuration
Fixes #
- [iOS/macOS]
enableBluetoothnow properly returnsfalse(not supported on Apple platforms)
2.0.1 #
Fixes naming issues
2.0.0 #
- [Android] Update java and minsdk to latest
- [Apple] Merge of ios and macos codebase
- Complete rewrite of permission system
1.2.6 #
- [Android] Fixes error on start broadcasting
1.2.5 #
- [Android] Added advertiseSet parameter to AdvertiseSettings to enable advertiseSet on Android o and higher devices.
1.2.4 #
- [iOS & macOS] Fixed an issue which caused the first advertisement not to be broadcast.
1.2.3 #
- [Android] Fixed requestPermission not working correctly.
1.2.2 #
- [Android] Fixed serviceUuid not working. (thanks @Shik1266 !)
- [Android] Updated compileSdk to 34.
1.2.1 #
- Fix build errors & crash on Windows
- Upgrade gradle to 8.1
1.2.0 #
Improvements:
- Added support for windows
- Updated bluetooth permissions system for Android, no need for permission handler anymore.
- Updated dependencies and several other small improvements.
1.1.1 #
Bugs fixed:
- Fixed an issue which caused the enableBluetooth function to reply twice.
- Fixed analyzer issues
- Upgraded dependencies
1.1.0 #
Upgraded android sdk to 33. Added permission check on enableBluetooth function.
1.0.0 #
Stable release including the changes noted in the beta releases. This release also updates Android dependencies.
1.0.0-beta.2 #
Fixed macOS version not working
1.0.0-beta.1 #
BREAKING CHANGES: You now define the data to be advertised using the AdvertiseData() constructor. AdvertiseData is the only supported object in iOS. AdvertiseSettings and other objects are only supported on Android.
NEW:
- You can now make use of the new startAdvertisingSet parameter on Android 26+
0.6.0 #
- Refactored large parts of the code for both Android & iOS.
- Upgraded Android to Android 12 permission system.
- Other minor improvements
0.5.0+1 #
Changes of 0.5.0 weren't visible on pub.dev
0.5.0 #
Added isSupported function to check if BLE advertising is supported by the device.
0.4.2 #
Fixed typo causing deviceName not to broadcast on iOS
0.4.1 #
Fixed bug on iOS which led to crash Added local name to advertising in iOS Updated Android dependencies
0.4.0 #
Added new options to AdvertiseData Removed embedding V1 for Android
0.3.0 #
Upgraded to null-safety Updated dependencies Changed to pedantic
Bug fixes
- Fixed null-pointer when bluetooth adapter isn't found
0.2.0 #
Add support for MacOS
0.1.0 #
Fixed several parts for Android:
- Advertising local name
- Advertising Manufacturer Data
- Advertising Service Data
0.0.4 #
Fixed iOS advertising not working
0.0.3 #
Fixed callback on Android
0.0.2 #
Fixed flutter v2 embedding
0.0.1 #
Initial version of the library. This version includes:
- broadcasting a custom UUID