watchRegion method

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

The function watchRegion checks if a region stream is already added and returns the value if not, otherwise throws an error. @returns The method is returning a Future<String?>.

Implementation

@override
Future<String?> watchRegion() async {
  if (_regionStream == null) {
    final returnVal = await methodChannel.invokeMethod<String>('watchRegion');
    return returnVal;
  } else {
    throw ("Region watch already added");
  }
}