unSubscribe method

dynamic unSubscribe()

Implementation

unSubscribe() async {
  assert(_partition.length != 0);

  // Call to native method
  await _channel.invokeMethod(Action.unSubscribe.name, <String, dynamic>{
    'listenId': uniqueListenerId,
    'appId': _appId,
    'partition': _partition,
  });

  // Close stream
  _streamController!.close();

  // Remove subscription from manager
  NotificationManager manager = NotificationManager.instance(_channel)!;
  manager.removeCallHandler(uniqueListenerId);
}