monitorCharacteristic method

Stream<CharacteristicWithValue> monitorCharacteristic(
  1. String serviceUuid,
  2. String characteristicUuid, {
  3. String? transactionId,
})

Returns a stream of notifications/indications from Characteristic matching specified UUIDs.

Emits CharacteristicWithValue for every observed change of the characteristic specified by serviceUuid and characteristicUuid If notifications are enabled they will be used in favour of indications. Optional transactionId could be used to cancel operation. Unsubscribing from the stream cancels monitoring.

Will result in error if discovery was not done during this connection.

Implementation

Stream<CharacteristicWithValue> monitorCharacteristic(
  String serviceUuid,
  String characteristicUuid, {
  String? transactionId,
}) =>
    _manager.monitorCharacteristicForDevice(
      this,
      serviceUuid,
      characteristicUuid,
      transactionId ?? TransactionIdGenerator.getNextId(),
    );