dispose method

  1. @override
void dispose()
override

Releases resources held by this session manager, closing streams and removing the method-channel handler.

The default implementation does nothing, so existing implementations keep working. Only call this when you own the instance lifecycle (for example in tests or embedder scenarios); the default singleton returned by GoogleCastSessionManager.instance is meant to live for the whole application lifetime.

Implementation

@override
void dispose() {
  if (_isDisposed) return;
  _isDisposed = true;
  _channel.setMethodCallHandler(null);
  _messageStreamController.close();
  _currentSessionStreamController.close();
}