dispose method
Dispose of the Signal instance
Implementation
Future<void> dispose() async {
// Wait for send queue to complete, ignoring errors
try {
await _sendQueue;
} catch (e) {
// Ignore send errors during disposal
}
if (_connectionCompleter != null && !_connectionCompleter!.isCompleted) {
_connectionCompleter!.completeError(Exception('Signal disposed'));
_connectionCompleter = null;
}
await _disconnect();
_messageHandlers.clear();
_locks.clear();
_clearAutoDisconnect();
_clearHeartbeat();
_sendQueue = Future.value();
}