getCharacteristic method

Future<BleCharacteristic> getCharacteristic(
  1. String characteristic, {
  2. required String service,
  3. bool preferCached = true,
  4. Duration? timeout,
})

Retrieves a specific characteristic from a service.

service is the UUID of the service. characteristic is the UUID of the characteristic. preferCached indicates whether to use cached services. If cache is empty, discoverServices() will be called. might throw UniversalBleException

Implementation

Future<BleCharacteristic> getCharacteristic(
  String characteristic, {
  required String service,
  bool preferCached = true,
  Duration? timeout,
}) async {
  BleService bluetoothService = await getService(
    service,
    preferCached: preferCached,
    timeout: timeout,
  );
  return bluetoothService.getCharacteristic(characteristic);
}