close method

Future close()

Closes the controller such that no further events will be added to stream. Any unfinished timers will be cancelled.

This method should be called in the onDispose() method of a Flutter widget.

Implementation

Future close() {
  _timer?.cancel();
  return _controller.close();
}