1

I am trying to develop an app which supports three platforms Android, Ios and Web and I have a socket implementation in the app, for socket I am using web_socket_channel 1.1.0. But for web I have to use HtmlWebSocketChannel class which is not working in android or ios build and for android or ios I have to use IOWebSocketChannel which is not working in web build and give compile-time error.

For Web

HtmlWebSocketChannel.connect(Uri.parse(strong text'wss://echo.websocket.org'))

For Mobile build

IOWebSocketChannel.connect(Uri.parse('wss://echo.websocket.org')),
Abhilash Chandran
  • 6,803
  • 3
  • 32
  • 50
  • 2
    Check the following [post](https://stackoverflow.com/questions/58710226/how-to-import-platform-specific-dependency-in-flutter-dart-combine-web-with-an/58713064#58713064). You will have to implement platform specific code for both and conditionally import them through a stub class. – Abhilash Chandran Jan 30 '20 at 13:30
  • https://stackoverflow.com/questions/58710226/how-to-import-platform-specific-dependency-in-flutter-dart-combine-web-with-an/58713064#58713064 – Praveen Soni Jan 05 '21 at 04:14

0 Answers0