universal_ble library

Classes

AndroidOptions
Scan models Android options to scan devices requestLocationPermission is used to request location permission on Android 12+ (API 31+). scanMode is used to set the scan mode for Bluetooth LE scan. Set reportDelayMillis timestamp for Bluetooth LE scan. If set to 0, you will be notified of scan results immediately. If > 0, scan results are queued up and delivered after the requested delay or 5000 milliseconds (whichever is higher). Note scan results may be delivered sooner if the internal buffers fill up. callbackType, matchMode, and numOfMatches map directly to the equivalent android.bluetooth.le.ScanSettings setters. When null, the plugin leaves them at the platform default — set them only if you need to override platform-side advert de-duplication (e.g. on Pixel hardware where the default settings throttle advertisements compared with nRF Connect).
BleCapabilities
BleCharacteristic
BleCommand
BleConnectionParametersUpdated
Link-layer connection parameters reported by Android onConnectionUpdated.
BleDescriptor
BleDevice
BlePeripheralAdvertisingStateChanged
BlePeripheralCapabilities
BlePeripheralCharacteristic
Peripheral/GATT server characteristic model that reuses BleCharacteristic.
BlePeripheralCharacteristicSubscriptionChanged
BlePeripheralConnectionStateChanged
BlePeripheralDescriptor
Peripheral/GATT server descriptor model that reuses BleDescriptor.
BlePeripheralEvent
BlePeripheralMtuChanged
BlePeripheralService
Peripheral/GATT server service model that reuses BleService.
BlePeripheralServiceAdded
BleService
BleUuidParser
CharacteristicSubscription
Manages subscription to a characteristic's notifications or indications.
ExclusionFilter
ManufacturerData
Represents the manufacturer data of a BLE device.
ManufacturerDataFilter
PeripheralAndroidOptions
PeripheralPlatformConfig
PeripheralReadRequestResult
PeripheralWriteRequestResult
PlatformConfig
Platform specific config to scan devices
ScanFilter
UniversalBle
UniversalBlePeripheral
UniversalBlePeripheralPlatform
UniversalBlePeripheralUnsupported
UniversalBlePlatform
WebOptions
Web options to scan devices optionalServices is a list of service uuid's to ensure that you can access the specified services after connecting to the device, by default services from scanFilter will be used optionalManufacturerData is list of CompanyIdentifier's and used to add ManufacturerData in advertisement results of selected device from web dialog, by default manufacturerData from scanFilter will be used Checkout more details on web Note: you will only get advertisements if Experimental Flag is enabled in the browser

Enums

AndroidScanCallbackType
Mirrors android.bluetooth.le.ScanSettings#setCallbackType. Pass any combination via AndroidOptions.callbackType (the plugin OR-folds the list before calling setCallbackType).
AndroidScanMatchMode
Mirrors android.bluetooth.le.ScanSettings#setMatchMode.
AndroidScanMode
AndroidScanNumOfMatches
Mirrors android.bluetooth.le.ScanSettings#setNumOfMatches.
AvailabilityState
BleConnectionPriority
Connection priority hint passed to requestConnectionPriority.
BleConnectionState
BleInputProperty
BleLogLevel
BleOutputProperty
CharacteristicProperty
PeripheralAdvertisingState
PeripheralAttributePermission
PeripheralReadinessState
QueueType
UniversalBleErrorCode
Unified error codes for all platforms

Extensions

BleCharacteristicExtension on BleCharacteristic
Extension methods for BleCharacteristic to simplify common operations.
BleConnectionParametersUpdatedX on BleConnectionParametersUpdated
Helpers for BleConnectionParametersUpdated reported on Android.
BleDeviceExtension on BleDevice
Extension methods for BleDevice to simplify common operations.
BleServiceExtension on BleService
Extension methods for BleService objects.
StringListToUUID on List<String>
Parse a list of strings to a list of UUIDs.

Typedefs

OnAvailabilityChange = void Function(AvailabilityState state)
OnConnectionChange = void Function(String deviceId, bool isConnected, String? error)
Central mode callbacks
OnConnectionParametersChange = void Function(BleConnectionParametersUpdated update)
OnPairingStateChange = void Function(String deviceId, bool isPaired)
OnPeripheralDescriptorReadRequest = PeripheralReadRequestResult? Function(String deviceId, String characteristicId, String descriptorId, int offset, Uint8List? value)
OnPeripheralDescriptorWriteRequest = PeripheralWriteRequestResult? Function(String deviceId, String characteristicId, String descriptorId, int offset, Uint8List? value)
OnPeripheralReadRequest = PeripheralReadRequestResult? Function(String deviceId, String characteristicId, int offset, Uint8List? value)
Peripheral mode callbacks
OnPeripheralWriteRequest = PeripheralWriteRequestResult? Function(String deviceId, String characteristicId, int offset, Uint8List? value)
OnQueueUpdate = void Function(String id, int remainingQueueItems)
OnScanResult = void Function(BleDevice scanResult)
OnValueChange = void Function(String deviceId, String characteristicId, Uint8List value, int? timestamp)

Exceptions / Errors

ConnectionException
Exception thrown when connection-related errors occur
PairingException
Exception thrown when pairing-related errors occur
UniversalBleException
Base exception class for all BLE errors with typed error codes
WebBluetoothGloballyDisabled
Exception thrown when Web Bluetooth API is globally disabled