stopNotifications method

  1. @override
Future<bool> stopNotifications(
  1. String deviceId,
  2. String service,
  3. String characteristic,
  4. int timeout,
)
override

Implementation

@override
Future<bool> stopNotifications(String deviceId, String service,
    String characteristic, int timeout) async {
  final key =
      "notification|$deviceId|${service.toLowerCase()}|${characteristic.toLowerCase()}";
  _notificationStreams[key]?.cancel();
  _notificationStreams.remove(key);

  final result = await _methodChannel
      .invokeMethod<Map<dynamic, dynamic>?>('stopNotifications', {
    'deviceId': deviceId,
    'service': service,
    'characteristic': characteristic,
    'timeout': timeout,
  });
  if (result == null || result["value"] == null) {
    throw PlatformException(
        code: "stopNotifications(): error retrieving value");
  }
  return result["value"];
}