clearRegionWatch method

  1. @override
Future<String?> clearRegionWatch()
override

The function clears the region watch and returns a string value. @returns The method is returning a Future<String?>.

Implementation

@override
Future<String?> clearRegionWatch() async {
  final returnVal =
      await methodChannel.invokeMethod<String>('clearRegionWatch');
  // Cancelling reaches the platform as onCancel, which drops the region
  // sink: without it the stream stays registered as a consumer for the
  // lifetime of the process, and a second getWatchRegionStream() would add
  // a duplicate listener.
  await _regionSubscription?.cancel();
  _regionSubscription = null;
  _regionStream = null;
  return returnVal;
}