lastConnection property

MockWebSocket get lastConnection

The connection opened last; throws a StateError when none was opened.

Implementation

MockWebSocket get lastConnection => _connections.isEmpty
    ? throw StateError('No WebSocket was opened')
    : _connections.last;