CentralManager class abstract interface

An object that scans for, discovers, connects to, and manages peripherals.

Implemented types

Constructors

CentralManager()
Gets the instance of CentralManager to use.
factory

Properties

characteristicNotified Stream<GATTCharacteristicNotifiedEventArgs>
Tells that retrieving the specified characteristic’s value changed.
no setter
connectionStateChanged Stream<PeripheralConnectionStateChangedEventArgs>
Tells that retrieving the specified peripheral's connection state changed.
no setter
discovered Stream<DiscoveredEventArgs>
Tells the central manager discovered a peripheral while scanning for devices.
no setter
hashCode int
The hash code for this object.
no setterinherited
logLevel ↔ Level
Effective level considering the levels established in this logger's parents (when hierarchicalLoggingEnabled is true).
getter/setter pairinherited
mtuChanged Stream<PeripheralMTUChangedEventArgs>
Callback indicating the MTU for a given device connection has changed.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state BluetoothLowEnergyState
Gets the manager's state.
no setterinherited
stateChanged Stream<BluetoothLowEnergyStateChangedEventArgs>
Tells the manager's state updated.
no setterinherited

Methods

authorize() Future<bool>
Requests permissions to be granted to this application. These permissions must be requested in your manifest, they should not be granted to your app, and they should have protection level dangerous, regardless whether they are declared by the platform or a third-party app.
inherited
connect(Peripheral peripheral) Future<void>
Establishes a local connection to a peripheral.
disconnect(Peripheral peripheral) Future<void>
Cancels an active or pending local connection to a peripheral.
discoverGATT(Peripheral peripheral) Future<List<GATTService>>
Discovers the GATT services, characteristics and descriptors of the peripheral.
getMaximumWriteLength(Peripheral peripheral, {required GATTCharacteristicWriteType type}) Future<int>
The maximum amount of data, in bytes, you can send to a characteristic in a single write type.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readCharacteristic(Peripheral peripheral, GATTCharacteristic characteristic) Future<Uint8List>
Retrieves the value of a specified characteristic.
readDescriptor(Peripheral peripheral, GATTDescriptor descriptor) Future<Uint8List>
Retrieves the value of a specified characteristic descriptor.
readRSSI(Peripheral peripheral) Future<int>
Retrieves the current RSSI value for the peripheral while connected to the central manager.
requestMTU(Peripheral peripheral, {required int mtu}) Future<int>
Request an MTU size used for a given connection. Please note that starting from Android 14, the Android Bluetooth stack requests the BLE ATT MTU to 517 bytes when the first GATT client requests an MTU, and disregards all subsequent MTU requests. Check out MTU is set to 517 for the first GATT client requesting an MTU for more information.
retrieveConnectedPeripherals() Future<List<Peripheral>>
Returns a list of the peripherals connected to the system.
setCharacteristicNotifyState(Peripheral peripheral, GATTCharacteristic characteristic, {required bool state}) Future<void>
Sets notifications or indications for the value of a specified characteristic.
showAppSettings() Future<void>
Show screen of details about a particular application.
inherited
startDiscovery({List<UUID>? serviceUUIDs}) Future<void>
Scans for peripherals that are advertising services.
stopDiscovery() Future<void>
Asks the central manager to stop scanning for peripherals.
toString() String
A string representation of this object.
inherited
writeCharacteristic(Peripheral peripheral, GATTCharacteristic characteristic, {required Uint8List value, required GATTCharacteristicWriteType type}) Future<void>
Writes the value of a characteristic.
writeDescriptor(Peripheral peripheral, GATTDescriptor descriptor, {required Uint8List value}) Future<void>
Writes the value of a characteristic descriptor.

Operators

operator ==(Object other) bool
The equality operator.
inherited