cancel method

Future<void> cancel()

Implementation

Future<void> cancel() async {
  if (_controller != null) {
    _logger.info('[CANCEL TOKEN]: cancelling the token.');
    _timer?.cancel();
    _timer = null;

    _cancelled = true;
    _controller?.add(null);
    await _controller?.close();
    _controller = null;
  }
}