dart-lang / web_socket_channel

StreamChannel wrappers for WebSockets.
https://pub.dev/packages/web_socket_channel
BSD 3-Clause "New" or "Revised" License
423 stars 112 forks source link

Error: Couldn't resolve the package 'web_socket_channel' in 'package:web_socket_channel/web_socket_channel.dart'. #210

Open Reinoal opened 2 years ago

Reinoal commented 2 years ago

version:2.1.0 , Code compiles, error at runtime: Couldn't resolve the package 'web_socket_channel' in 'package:web_socket_channel/web_socket_channel.dart'.

lib/plugins/roslib/lib/core/ros.dart:5:8: Error: Not found: 'package:web_socket_channel/web_socket_channel.dart' import 'package:web_socket_channel/web_socket_channel.dart'; ^ lib/plugins/roslib/lib/core/ros_io.dart:1:8: Error: Not found: 'package:web_socket_channel/web_socket_channel.dart' import 'package:web_socket_channel/web_socket_channel.dart'; ^ Error: Couldn't resolve the package 'web_socket_channel' in 'package:web_socket_channel/io.dart'. lib/plugins/roslib/lib/core/ros_io.dart:2:8: Error: Not found: 'package:web_socket_channel/io.dart' import 'package:web_socket_channel/io.dart'; ^ lib/plugins/roslib/lib/core/ros.dart:49:8: Error: Type 'WebSocketChannel' not found. late WebSocketChannel _channel; ^^^^^^^^^^^^^^^^ lib/plugins/roslib/lib/core/ros_io.dart:4:1: Error: Type 'WebSocketChannel' not found. WebSocketChannel initializeWebSocketChannel(String url) { ^^^^^^^^^^^^^^^^ lib/plugins/roslib/lib/core/ros.dart:49:8: Error: 'WebSocketChannel' isn't a type. late WebSocketChannel _channel; ^^^^^^^^^^^^^^^^ lib/plugins/roslib/lib/core/ros.dart:89:10: Error: 'WebSocketChannelException' isn't a type. } on WebSocketChannelException catch (e) { ^^^^^^^^^^^^^^^^^^^^^^^^^ lib/plugins/roslib/lib/core/ros_io.dart:5:10: Error: Undefined name 'IOWebSocketChannel'. return IOWebSocketChannel.connect(url); ^^^^^^^^^^^^^^^^^^

Unhandled exception: FileSystemException(uri=org-dartlang-untranslatable-uri:package%3Aweb_socket_channel%2Fweb_socket_channel.dart; message=StandardFileSystem only supports file: and data: URIs)

0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:34:7)

1 asFileUri (package:vm/kernel_front_end.dart:623:37)

2 writeDepfile (package:vm/kernel_front_end.dart:763:21)

#3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:586:9) #4 starter (package:flutter_frontend_server/server.dart:85:12) #5 main (file:///opt/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:13:24)
phamhien2102 commented 2 years ago

version:2.1.0 , Code compiles, error at runtime: Couldn't resolve the package 'web_socket_channel' in 'package:web_socket_channel/web_socket_channel.dart'.

lib/plugins/roslib/lib/core/ros.dart:5:8: Error: Not found: 'package:web_socket_channel/web_socket_channel.dart' import 'package:web_socket_channel/web_socket_channel.dart'; ^ lib/plugins/roslib/lib/core/ros_io.dart:1:8: Error: Not found: 'package:web_socket_channel/web_socket_channel.dart' import 'package:web_socket_channel/web_socket_channel.dart'; ^ Error: Couldn't resolve the package 'web_socket_channel' in 'package:web_socket_channel/io.dart'. lib/plugins/roslib/lib/core/ros_io.dart:2:8: Error: Not found: 'package:web_socket_channel/io.dart' import 'package:web_socket_channel/io.dart'; ^ lib/plugins/roslib/lib/core/ros.dart:49:8: Error: Type 'WebSocketChannel' not found. late WebSocketChannel _channel; ^^^^^^^^^^^^^^^^ lib/plugins/roslib/lib/core/ros_io.dart:4:1: Error: Type 'WebSocketChannel' not found. WebSocketChannel initializeWebSocketChannel(String url) { ^^^^^^^^^^^^^^^^ lib/plugins/roslib/lib/core/ros.dart:49:8: Error: 'WebSocketChannel' isn't a type. late WebSocketChannel _channel; ^^^^^^^^^^^^^^^^ lib/plugins/roslib/lib/core/ros.dart:89:10: Error: 'WebSocketChannelException' isn't a type. } on WebSocketChannelException catch (e) { ^^^^^^^^^^^^^^^^^^^^^^^^^ lib/plugins/roslib/lib/core/ros_io.dart:5:10: Error: Undefined name 'IOWebSocketChannel'. return IOWebSocketChannel.connect(url); ^^^^^^^^^^^^^^^^^^

Unhandled exception: FileSystemException(uri=org-dartlang-untranslatable-uri:package%3Aweb_socket_channel%2Fweb_socket_channel.dart; message=StandardFileSystem only supports file: and data: URIs) #0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:34:7) #1 asFileUri (package:vm/kernel_front_end.dart:623:37) #2 writeDepfile (package:vm/kernel_front_end.dart:763:21) #3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:586:9) #4 starter (package:flutter_frontend_server/server.dart:85:12) #5 main (file:///opt/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:13:24)

Hi, I found this in link Instead of: import 'package:web_socket_channel/web_socket_channel.dart'; You should: import 'package:web_socket_channel/io.dart';