startNotifications method

Future<void> startNotifications()

Request the device to send notifications each time the value changes.

The new value will be notified using the oncharacteristicvaluechanged event. You may need to use WebBluetoothConverters.convertJSDataViewToByteData to get useful data.

  • May throw NotSupportedError if the operation is not allowed. Check properties to see if it is supported.

  • May throw SecurityError if the characteristic is blocked form notifying using a blocklist.

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

  • May throw InvalidStateError if characteristic is null

See:

Implementation

Future<void> startNotifications() async {
  final promise = _JSUtil.callMethod(_jsObject, "startNotifications", []);
  await _JSUtil.promiseToFuture(promise);
}