FlutterReactiveBle class

FlutterReactiveBle is the facade of the library. Its interface allows to perform all the supported BLE operations.

Constructors

FlutterReactiveBle()
factory
FlutterReactiveBle.witDependencies({required DeviceScanner deviceScanner, required DeviceConnector deviceConnector, required ConnectedDeviceOperation connectedDeviceOperation, required Logger debugLogger, required Future<void> initialization, required ReactiveBlePlatform reactiveBlePlatform})
Create a new instance where injected dependencies are used.

Properties

characteristicValueStream Stream<CharacteristicValue>
A stream providing value updates for all the connected BLE devices.
no setter
connectedDeviceStream Stream<ConnectionStateUpdate>
A stream providing connection updates for all the connected BLE devices.
no setter
hashCode int
The hash code for this object.
no setterinherited
logLevel LogLevel
Sets the verbosity of debug output.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scanRegistry → DiscoveredDevicesRegistryImpl
Registry that keeps track of all BLE devices found during a BLE scan.
final
status BleStatus
Returns the current status of the BLE subsystem of the host device.
no setter
statusStream Stream<BleStatus>
A stream providing the host device BLE subsystem status updates.
no setter

Methods

clearGattCache(String deviceId) Future<void>
Clears GATT attribute cache on Android using undocumented API. Completes with an error in case of a failure.
connectToAdvertisingDevice({required String id, required List<Uuid> withServices, required Duration prescanDuration, Map<Uuid, List<Uuid>>? servicesWithCharacteristicsToDiscover, Duration? connectionTimeout}) Stream<ConnectionStateUpdate>
Scans for a specific device and connects to it in case a device containing the specified id is found and that is advertising the services specified in withServices.
connectToDevice({required String id, Map<Uuid, List<Uuid>>? servicesWithCharacteristicsToDiscover, Duration? connectionTimeout}) Stream<ConnectionStateUpdate>
Establishes a connection to a BLE device.
deinitialize() Future<void>
Deinitializes this FlutterReactiveBle instance and its platform-specific counterparts.
discoverAllServices(String deviceId) Future<void>
Performs service discovery on the peripheral.
discoverServices(String deviceId) Future<List<DiscoveredService>>
Performs service discovery on the peripheral and returns the discovered services.
getDiscoveredServices(String deviceId) Future<List<Service>>
Services can be discovered by:
initialize() Future<void>
Initializes this FlutterReactiveBle instance and its platform-specific counterparts.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readCharacteristic(QualifiedCharacteristic characteristic) Future<List<int>>
Reads the value of the specified characteristic.
readRssi(String deviceId) Future<int>
Reads the RSSI of the of the peripheral with the given device ID. The peripheral must be connected, otherwise a PlatformException will be thrown
requestConnectionPriority({required String deviceId, required ConnectionPriority priority}) Future<void>
Requests for a connection parameter update on the connected device.
requestMtu({required String deviceId, required int mtu}) Future<int>
Request a specific MTU for a connected device.
resolve(QualifiedCharacteristic characteristic) Future<Iterable<Characteristic>>
resolveSingle(QualifiedCharacteristic characteristic) Future<Characteristic>
scanForDevices({required List<Uuid> withServices, ScanMode scanMode = ScanMode.balanced, bool requireLocationServicesEnabled = true}) Stream<DiscoveredDevice>
Scan for BLE peripherals advertising the services specified in withServices or for all BLE peripherals, if no services is specified. It is recommended to always specify some services.
subscribeToCharacteristic(QualifiedCharacteristic characteristic) Stream<List<int>>
Subscribes to updates from the characteristic specified.
toString() String
A string representation of this object.
inherited
writeCharacteristicWithoutResponse(QualifiedCharacteristic characteristic, {required List<int> value}) Future<void>
Writes a value to the specified characteristic without waiting for an acknowledgement.
writeCharacteristicWithResponse(QualifiedCharacteristic characteristic, {required List<int> value}) Future<void>
Writes a value to the specified characteristic awaiting for an acknowledgement.

Operators

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