Flutter web-不支持的操作:InternetAddress.LOOPBACK_IP_V4



我想试用flutter HttpServer库,但一开始就卡住了。

import 'dart:io';
void main() async {
var server = await HttpServer.bind(InternetAddress.loopbackIPv4, 8080);
}

进行以下异常:

Error: Unsupported operation: InternetAddress.LOOPBACK_IP_V4
at Object.throw_ [as throw] (http://localhost:43203/dart_sdk.js:4040:11)
at Function.get LOOPBACK_IP_V4 [as LOOPBACK_IP_V4] (http://localhost:43203/dart_sdk.js:59789:17)
at Function.get loopbackIPv4 [as loopbackIPv4] (http://localhost:43203/dart_sdk.js:59786:33)
at main (http://localhost:43203/packages/dolphin/main.dart.lib.js:13:68)
at main.next (<anonymous>)
at runBody (http://localhost:43203/dart_sdk.js:41692:34)
at Object._async [as async] (http://localhost:43203/dart_sdk.js:41720:7)
at Object.main$ [as main] (http://localhost:43203/packages/dolphin/main.dart.lib.js:12:18)
at main$ (http://localhost:43203/web_entrypoint.dart.lib.js:14:12)
at main$.next (<anonymous>)
at onValue (http://localhost:43203/dart_sdk.js:41673:33)
at _RootZone.runUnary (http://localhost:43203/dart_sdk.js:41558:58)
at _FutureListener.thenAwait.handleValue (http://localhost:43203/dart_sdk.js:37044:29)
at handleValueCallback (http://localhost:43203/dart_sdk.js:37545:49)
at Function._propagateToListeners (http://localhost:43203/dart_sdk.js:37577:17)
at async._AsyncCallbackEntry.new.callback (http://localhost:43203/dart_sdk.js:37333:27)
at Object._microtaskLoop (http://localhost:43203/dart_sdk.js:41774:13)
at _startMicrotaskLoop (http://localhost:43203/dart_sdk.js:41780:13)
at http://localhost:43203/dart_sdk.js:37782:9

Flutter verison:

Flutter 1.17.0 • channel beta • https://github.com/flutter/flutter.git
Framework • revision d3ed9ec945 (vor 2 Wochen) • 2020-04-06 14:07:34 -0700
Engine • revision c9506cb8e9
Tools • Dart 2.8.0 (build 2.8.0-dev.18.0 eea9717938)

OS:

Operating System: Debian GNU/Linux 10 (buster)
Kernel: Linux 4.19.0-8-amd64
Architecture: x86-64

如果有人能帮我/知道我犯了什么错,那就太棒了。谢谢:(

import 'dart:io';

flutter web.issue链接不支持https://github.com/flutter/flutter/issues/39998

  1. 在您试图修复的库中使用通用IO:Pub.Dev-Link

  2. 编写一个备份函数来替换为您中断的函数。查看此git提交,了解选项。我不得不替换InternetAddress.lookup,但你必须找到另一个网络支持的功能来替换InternetAddress-LOOPBACK_IP_V4:在一个颤振项目中解决的问题

相关内容

  • 没有找到相关文章

最新更新