dispose method

void dispose()

Closes the stream controller, cancels the timer, and stops emitting DateTime updates.

Call this method when the controller is no longer needed to prevent memory leaks.

Implementation

void dispose() {
  _timer?.cancel();
  if (!_streamController.isClosed) {
    _streamController.close();
  }
}