getPrimaryService method

Future<WebBluetoothRemoteGATTService> getPrimaryService(
  1. String serviceUUID
)

Get a the primary services on the current device.

Only services defined in RequestOptions and BluetoothScanFilter from when Bluetooth.requestDevice was called are available.

serviceUUID is the UUID (lower case) of the service to get.

  • May throw SecurityError if a service's UUID is on a blocklist.

  • May throw NetworkError if the GATT server is not connected.

  • May throw InvalidStateError if GATT is null.

  • May throw NotFoundError if the services was found.

See:

Implementation

Future<WebBluetoothRemoteGATTService> getPrimaryService(
    final String serviceUUID) async {
  final promise = _JSUtil.callMethod(
      _jsObject, "getPrimaryService", [serviceUUID.toLowerCase()]);
  final result = await _JSUtil.promiseToFuture(promise);
  return WebBluetoothRemoteGATTService.fromJSObject(result, device);
}