异常:不支持的操作:RawSocket构造函数(带有sqljocky5的Dart:^ 2.2.1)

时间:2019-02-28 19:50:31

标签: mysql dart database-connection sqljocky

我正在尝试将dart与MySQL数据库连接。我安装了MySQL工作台并创建了一个简单的数据库,修改了pubspec.yaml并添加了MySQL所需的其他任何依赖项。但是我一直在浏览器中产生异常。

  

例外:不支持的操作:RawSocket构造函数   堆栈:dart:sdk_internal connect package:sqljocky5 / comm / buffered_socket.dart 60:7 defaultSocketFactory软件包:sqljocky5 / comm / buffered_socket.dart 72:20 connect dart:sdk_internal async package:sqljocky5 / comm / buffered_socket.dart 70: :sqljocky5 / comm / comm.dart 163:26 connect dart:sdk_internal异步包:sqljocky5 / comm / comm.dart 156:53 connect包:sqljocky5 / connection / impl.dart 102:22 connect dart:sdk_internal异步包:sqljocky5 / connection / impl.dart 101:64 connect package:sqljocky5 / connection / connection.dart 36:7 connect package:pbcat_form / src / start / start.dart 84:22 main dart:sdk_internal async package:pbcat_form / src / start / start .dart 75:10主程序包:angular / src / core / zone / ng_zone.dart 134:16 dart:sdk_internal运行包:angular / src / core / zone / ng_zone.dart 131:12 [_run] dart:sdk_internal runGuarded程序包:angular / src / core / zone / ng_zone.dart 302:22 runGuarded package:angular / src / core / linker / app_view.dart 582:7 package:sqljocky5 / comm / buffered_socket.dart 70:6连接包:sqljocky5 / comm / comm.dart 163:26连接dart:sdk_internal异步包:sqljocky5 / comm / comm.dart 156:53连接包:sqljocky5 / connection / impl.dart 102:22连接dart:sdk_internal异步包:sqljocky5 / connection / impl.dart 101:64连接包:sqljocky5 / connection / connection.dart 36:7连接包:pbcat_form / src / start / start.dart 84:22 main dart:sdk_internal异步包:pbcat_form / src / start / start.dart 75:10主程序包:Angular / src / core / zone / ng_zone.dart 134:16 dart:sdk_internal run package:angular / src / core / zone / ng_zone.dart 131:12 [_run] dart:sdk_internal runGuarded软件包:angular / src / core / zone / ng_zone.dart 302:22 runGuarded软件包:angular / src / core / linker / app_view.dart 582:7

2 个答案:

答案 0 :(得分:0)

代码似乎正在这样做:-

RawSocket.connect(主机,端口);

但是RawSocket上没有connect方法,请参见here

在Dart 2.2中可能已更改,例如已添加了get / set RawOption方法

答案 1 :(得分:0)

https://api.dart.dev/stable/2.2.0/dart-io/RawSocket/connect.html

外部静态Future连接(主机,整数端口, {sourceAddress,Duration超时});