~emersion/goguma

fde81ecfd1bc122563e703218fe24c831ddc691a — Simon Ser a month ago c737e1b
client: throw StateError when dispose() is called twice
1 files changed, 4 insertions(+), 1 deletions(-)

M lib/client.dart
M lib/client.dart => lib/client.dart +4 -1
@@ 118,7 118,7 @@ class Client {

	Future<void> connect() async {
		if (_messagesController.isClosed) {
			throw StateError('connect() called after disconnect()');
			throw StateError('connect() called after dispose()');
		}

		// Always switch to the disconnected state, because users reset their


@@ 505,6 505,9 @@ class Client {
	}

	void dispose() {
		if (_messagesController.isClosed) {
			throw StateError('dispose() called twice');
		}
		_log('Destroying client');
		_autoReconnect = false;
		_reconnectTimer?.cancel();