adamlofts / mysql1_dart

MySQL driver for Dart
Other
134 stars 46 forks source link

Unsupported operation RawSocket #67

Closed princesanjivy closed 3 years ago

princesanjivy commented 3 years ago

I get this error, also I'm on Flutter Web and OS Ubuntu.

Error: Unsupported operation: RawSocket constructor at Object.throw_ [as throw] at Function.connect

I googled this issue and I found out that RawSocket class doesn't have a connect method. Stackoverflow

Any solutions would be really helpful!

rolong13 commented 3 years ago

I got a similar message, Error: Unsupported operation: RawSocket constructor In my case, it appears it has to do with a MySQL query I am trying to run using the MySQL1 package, latest version as of tis writing.

But it appears it only fails when try to compile the web, because the code works fine when using the android emulator...

So it looks like this functionality needs to be added to MySQL1 as soon as possible since Flutter 2.0 has open the flood gates and web is stable.

Looking at the code today, but not sure how far I will get if at all, still in the process of learning dart...:)

rolong13 commented 3 years ago

Here is the dump of the error, looks like the problem is in the buffered_socket.dart file, I took a look, but still looking like a foreign language to me :(, really hope someone can help soon...:)

Launching lib\main.dart on Chrome in debug mode... Debug service listening on ws://127.0.0.1:53856/zMb4gCgCJhg=/ws Running with unsound null safety For more information see https://dart.dev/null-safety/unsound-null-safety Connecting to VM Service at ws://127.0.0.1:53856/zMb4gCgCJhg=/ws this sucks.. Error: Unsupported operation: RawSocket constructor at Object.throw_ [as throw] (http://localhost:53826/dart_sdk.js:5334:11) at Function.connect (http://localhost:53826/dart_sdk.js:58946:17) at defaultSocketFactory (http://localhost:53826/packages/mysql1/src/buffered_socket.dart.lib.js:115:27) at connect (http://localhost:53826/packages/mysql1/src/buffered_socket.dart.lib.js:125:42) at connect.next () at runBody (http://localhost:53826/dart_sdk.js:39052:34) at Object._async [as async] (http://localhost:53826/dart_sdk.js:39083:7) at Function.connect (http://localhost:53826/packages/mysql1/src/buffered_socket.dart.lib.js:123:20) at connect (http://localhost:53826/packages/mysql1/src/single_connection.dart.lib.js:258:60) at connect.next () at runBody (http://localhost:53826/dart_sdk.js:39052:34) at Object._async [as async] (http://localhost:53826/dart_sdk.js:39083:7) at Function.connect (http://localhost:53826/packages/mysql1/src/single_connection.dart.lib.js:252:20) at getConnection (http://localhost:53826/packages/flutter_2_mysql_test/mysql.dart.lib.js:31:56) at getConnection.next () at runBody (http://localhost:53826/dart_sdk.js:39052:34) at Object._async [as async] (http://localhost:53826/dart_sdk.js:39083:7) at mysql.Mysql.new.getConnection (http://localhost:53826/packages/flutter_2_mysql_test/mysql.dart.lib.js:29:20) at _getWeight (http://localhost:53826/packages/flutter_2_mysql_test/main.dart.lib.js:35:10) at main$ (http://localhost:53826/packages/flutter_2_mysql_test/main.dart.lib.js:46:5) at main (http://localhost:53826/web_entrypoint.dart.lib.js:46:29) at main.next () at http://localhost:53826/dart_sdk.js:39032:33 at _RootZone.runUnary (http://localhost:53826/dart_sdk.js:38889:58) at _FutureListener.thenAwait.handleValue (http://localhost:53826/dart_sdk.js:33875:29) at handleValueCallback (http://localhost:53826/dart_sdk.js:34435:49) at Function._propagateToListeners (http://localhost:53826/dart_sdk.js:34473:17) at _Future.new.[_completeWithValue] (http://localhost:53826/dart_sdk.js:34315:23) at http://localhost:53826/dart_sdk.js:33526:46 at _RootZone.runUnary (http://localhost:53826/dart_sdk.js:38889:58) at _FutureListener.then.handleValue (http://localhost:53826/dart_sdk.js:33875:29) at handleValueCallback (http://localhost:53826/dart_sdk.js:34435:49) at Function._propagateToListeners (http://localhost:53826/dart_sdk.js:34473:17) at _Future.new.[_completeWithValue] (http://localhost:53826/dart_sdk.js:34315:23) at async._AsyncCallbackEntry.new.callback (http://localhost:53826/dart_sdk.js:34338:35) at Object._microtaskLoop (http://localhost:53826/dart_sdk.js:39176:13) at _startMicrotaskLoop (http://localhost:53826/dart_sdk.js:39182:13) at http://localhost:53826/dart_sdk.js:34689:9

DavideDessi319 commented 3 years ago

Any news on this issue?

rodrigo-ehlers commented 3 years ago

I'm having the same issue, running great on Android Emulator, failing on Web. Hope MySQL1 get Web ASAP. For now, to my code work as it should, I need to write the querys on PHP and access the .php file from my server with http.dart dependecy. It works, but is far from a good solution.

MahmoodAliL commented 3 years ago
Any news on this issue?

adamlofts commented 3 years ago

This package opens a socket to the database. The web platform does not support sockets and so this package does not work on flutter web.

Anirban-Chand commented 2 years ago

This package opens a socket to the database. The web platform does not support sockets and so this package does not work on flutter web.

Is there any alternative to connect the MySQL server to Flutter WebApp?