core_bluetooth 1.0.0 copy "core_bluetooth: ^1.0.0" to clipboard
core_bluetooth: ^1.0.0 copied to clipboard

CoreBluetooth wrapper for Dart on iOS and macOS.

core_bluetooth #

A clean Dart wrapper around Apple's CoreBluetooth framework for iOS and macOS.

Status #

✅ Fully implemented.

Apple CoreBluetooth symbol names are the primary public API. Helper wrapper types exist where Dart needs them, but they intentionally do not use the CB prefix.

Dictionary-shaped CoreBluetooth APIs are exposed as typed Dart wrapper classes where practical, while still mirroring the Apple CoreBluetooth surface.

The example app builds and launches on macOS, and the central-role example flow has been exercised there.

Not fully supported: Dart limitations. This package is implemented as faithfully as practical within Dart's type-system and runtime constraints.

Contract #

Below is the CoreBluetooth API map we should treat as the contract.

Legend:

  • fully implemented
  • partially implemented
  • not implemented yet

Only mark a symbol when its public API is fully implemented to match the Apple CoreBluetooth surface we intend to mirror.

Top-Level Framework #

  • CBManager
  • CBPeer
  • CBUUID
  • CBError
  • CBATTRequest
  • CBL2CAPChannel
  • CBL2CAPPSM

Central Role #

  • CBCentralManager
  • CBCentralManagerDelegate
  • CBCentral
  • CBConnectionEvent

CBCentralManager #

  • init()
  • init(delegate:queue:)
  • init(delegate:queue:options:)
  • var delegate
  • var isScanning
  • class func supports(_ feature: CBCentralManager.Feature) -> Bool
  • struct CBCentralManager.Feature
  • func scanForPeripherals(withServices:options:)
  • func stopScan()
  • func retrievePeripherals(withIdentifiers:)
  • func retrieveConnectedPeripherals(withServices:)
  • func connect(_:options:)
  • func cancelPeripheralConnection(_:)
  • func registerForConnectionEvents(options:)
  • class var authorization
  • inherited from CBManager: var state

CBCentralManagerDelegate #

  • centralManagerDidUpdateState(_:)
  • centralManager(_:willRestoreState:)
  • centralManager(_:didDiscover:advertisementData:rssi:)
  • centralManager(_:didConnect:)
  • centralManager(_:didFailToConnect:error:)
  • centralManager(_:didDisconnectPeripheral:error:)
  • centralManager(_:didDisconnectPeripheral:timestamp:isReconnecting:error:)
  • centralManager(_:connectionEventDidOccur:for:)
  • centralManager(_:didUpdateANCSAuthorizationFor:)

CBCentral #

  • inherits CBPeer
  • var maximumUpdateValueLength

Peripheral Role #

  • CBPeripheral
  • CBPeripheralDelegate
  • CBPeripheralManager
  • CBPeripheralManagerDelegate

CBPeripheral #

  • var delegate
  • var name
  • var identifier
  • var state
  • var services
  • var ancsAuthorized
  • var canSendWriteWithoutResponse
  • func readRSSI()
  • func discoverServices(_:)
  • func discoverIncludedServices(_:for:)
  • func discoverCharacteristics(_:for:)
  • func discoverDescriptors(for:)
  • func readValue(for: CBCharacteristic)
  • func readValue(for: CBDescriptor)
  • func writeValue(_:for: CBCharacteristic,type:)
  • func writeValue(_:for: CBDescriptor)
  • func setNotifyValue(_:for:)
  • func maximumWriteValueLength(for:)
  • func openL2CAPChannel(_:)

CBPeripheralDelegate #

  • peripheralDidUpdateName(_:)
  • peripheral(_:didModifyServices:)
  • peripheral(_:didReadRSSI:error:)
  • peripheral(_:didDiscoverServices:)
  • peripheral(_:didDiscoverIncludedServicesFor:error:)
  • peripheral(_:didDiscoverCharacteristicsFor:error:)
  • peripheral(_:didDiscoverDescriptorsFor:error:)
  • peripheral(_:didUpdateValueFor:error:) for CBCharacteristic
  • peripheral(_:didUpdateValueFor:error:) for CBDescriptor
  • peripheral(_:didWriteValueFor:error:) for CBCharacteristic
  • peripheral(_:didWriteValueFor:error:) for CBDescriptor
  • peripheral(_:didUpdateNotificationStateFor:error:)
  • peripheralIsReady(toSendWriteWithoutResponse:)
  • peripheral(_:didOpen:error:)

CBPeripheralManager #

  • init()
  • init(delegate:queue:)
  • init(delegate:queue:options:)
  • var delegate
  • var isAdvertising
  • func add(_:)
  • func remove(_:)
  • func removeAllServices()
  • func startAdvertising(_:)
  • func stopAdvertising()
  • func updateValue(_:for:onSubscribedCentrals:) -> Bool
  • func respond(to:withResult:)
  • func setDesiredConnectionLatency(_:for:)
  • func publishL2CAPChannel(withEncryption:)
  • func unpublishL2CAPChannel(_:)
  • class var authorization
  • inherited from CBManager: var state

CBPeripheralManagerDelegate #

  • peripheralManagerDidUpdateState(_:)
  • peripheralManager(_:willRestoreState:)
  • peripheralManagerDidStartAdvertising(_:error:)
  • peripheralManager(_:didAdd:error:)
  • peripheralManager(_:central:didSubscribeTo:)
  • peripheralManager(_:central:didUnsubscribeFrom:)
  • peripheralManagerIsReady(toUpdateSubscribers:)
  • peripheralManager(_:didReceiveRead:)
  • peripheralManager(_:didReceiveWrite:)
  • peripheralManager(_:didPublishL2CAPChannel:error:)
  • peripheralManager(_:didUnpublishL2CAPChannel:error:)
  • peripheralManager(_:didOpen:error:)

GATT Model Types #

  • CBAttribute
  • CBService
  • CBMutableService
  • CBCharacteristic
  • CBMutableCharacteristic
  • CBDescriptor
  • CBMutableDescriptor

CBAttribute #

  • var uuid

CBService #

  • var peripheral
  • var isPrimary
  • var includedServices
  • var characteristics

CBMutableService #

  • writable versions of service properties

CBCharacteristic #

  • var service
  • var value
  • var descriptors
  • var properties
  • var isNotifying
  • var isBroadcasted

CBMutableCharacteristic #

  • init(type:properties:value:permissions:)

CBDescriptor #

  • var characteristic
  • var value

CBMutableDescriptor #

  • init(type:value:)

Supporting Enums / Option Sets / Constants #

  • CBManagerState
  • CBManagerAuthorization
  • CBPeripheralState
  • CBCharacteristicWriteType
  • CBCentralManager.Feature
  • CBCharacteristicProperties
  • CBAttributePermissions
  • CBPeripheralManagerConnectionLatency
  • CBATTError.Code
  • advertisement-data keys
  • peripheral-scanning option keys
  • peripheral-connection option keys
  • peripheral-manager initialization option keys
  • peripheral-manager restoration keys
  • central-manager restoration keys
  • connection-event matching option keys
1
likes
0
points
11
downloads

Publisher

verified publisherjamcorder.com

Weekly Downloads

CoreBluetooth wrapper for Dart on iOS and macOS.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on core_bluetooth

Packages that implement core_bluetooth