File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ typedef OnOpenCallback = void Function();
1313class WebSocketImpl {
1414 WebSocketImpl (this ._url);
1515
16- final String ? _url;
16+ final String _url;
1717 WebSocket ? _socket;
1818 OnOpenCallback ? onOpen;
1919 OnMessageCallback ? onMessage;
@@ -26,9 +26,9 @@ class WebSocketImpl {
2626 try {
2727 if (webSocketSettings.allowBadCertificate) {
2828 /// Allow self-signed certificate, for test only.
29- _socket = await _connectForBadCertificate (_url! , webSocketSettings);
29+ _socket = await _connectForBadCertificate (_url, webSocketSettings);
3030 } else {
31- _socket = await WebSocket .connect (_url! ,
31+ _socket = await WebSocket .connect (_url,
3232 protocols: protocols, headers: webSocketSettings.extraHeaders);
3333 }
3434
Original file line number Diff line number Diff line change @@ -66,6 +66,11 @@ class WebSocketInterface implements Socket {
6666 @override
6767 void connect () async {
6868 logger.debug ('connect()' );
69+
70+ if (_url == null ) {
71+ throw AssertionError ('Invalid argument: _url' );
72+ }
73+
6974 if (isConnected ()) {
7075 logger.debug ('WebSocket $_url is already connected' );
7176 return ;
@@ -78,7 +83,7 @@ class WebSocketInterface implements Socket {
7883 }
7984 logger.debug ('connecting to WebSocket $_url ' );
8085 try {
81- _ws = WebSocketImpl (_url);
86+ _ws = WebSocketImpl (_url! );
8287
8388 _ws! .onOpen = () {
8489 _closed = false ;
You can’t perform that action at this time.
0 commit comments