nextConnection property
Future<MockWebSocket>
get
nextConnection
The next connection this getter has not returned yet: the first call gives the first connection, the second call the second, and so on. When the client has not opened it yet, the future completes when it does. This is how a test waits for a (re)connection.
Implementation
Future<MockWebSocket> get nextConnection {
if (_taken < _connections.length) {
return Future.value(_connections[_taken++]);
}
final waiting = Completer<MockWebSocket>();
_waiting.add(waiting);
return waiting.future;
}