close method

void close()

Closes the StreamController and cleans up resources.

After calling this method, no more events can be added or listened to.

Implementation

void close() {
  _stream.close(); // Close the stream to release resources.
}