运行Flutter Web项目时出现问题

时间:2019-07-10 07:26:38

标签: flutter dart dart-webui flutter-web flutterwebviewplugin

我启动了一个新的Flutter Web项目,并正确执行了所有安装步骤。当我开始调试或运行它时。这是我在运行时获取的日志。它还会打开chrome窗口,但屏幕上没有任何内容。我没有修改任何main.dart之类的预生成文件。

[INFO] Connecting to the build daemon...
[INFO] Generating build script...
[INFO] Generating build script completed, took 527ms
[INFO]
[INFO] Starting daemon...
[INFO] Initializing inputs
[INFO] Reading cached asset graph...
[INFO] Reading cached asset graph completed, took 490ms
[INFO] Checking for updates since last build...
[INFO] Checking for updates since last build completed, took 1.5s
[INFO] Initializing inputs
[INFO] Reading cached asset graph...
[INFO] Reading cached asset graph completed, took 490ms
[INFO]
[INFO] Checking for updates since last build...
[INFO] Checking for updates since last build completed, took 1.5s
[INFO]
[INFO] Setting up file watchers...
[INFO] Setting up file watchers completed, took 5ms
[INFO] Registering build targets...
[INFO] Starting initial build...
[INFO] Serving DevTools at http://127.0.0.1:57020
[INFO] Starting resource servers...
[INFO] Serving `web` on http://127.0.0.1:57011
[INFO] About to build [web]...
[INFO] Running build...
[INFO] 1.0s elapsed, 0/0 actions completed.
[INFO] Running build completed, took 1.2s
[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 474ms
[INFO] Succeeded after 1.7s with 0 outputs (0 actions)
[INFO] ------------------------------------------------------------------------
Unhandled exception:
FormatException: Unexpected character (at character 1)
Not Found
^
#0      _ChunkedJsonParser.fail  (dart:convert-patch/convert_patch.dart:1392:5)
#1      _ChunkedJsonParser.parseNumber  (dart:convert-patch/convert_patch.dart:1259:9)
#2      _ChunkedJsonParser.parse  (dart:convert-patch/convert_patch.dart:924:22)
#3      _parseJson  (dart:convert-patch/convert_patch.dart:29:10)
#4      JsonDecoder.convert  (dart:convert/json.dart:493:36)
#5      JsonCodec.decode  (dart:convert/json.dart:151:41)
#6      jsonDecode  (dart:convert/json.dart:94:10)
#7      parse 
package:source_maps/parser.dart:27
#8      Sources.scriptParsed  (package:dwds/src/sources.dart:55:19)
<asynchronous suspension>
#9      _RootZone.runUnaryGuarded  (dart:async/zone.dart:1314:10)
#10     CastStreamSubscription._onData  (dart:_internal/async_cast.dart:81:11)
#11     _RootZone.runUnaryGuarded  (dart:async/zone.dart:1314:10)
#12     _BufferingStreamSubscription._sendData  (dart:async/stream_impl.dart:336:11)
#13     _BufferingStreamSubscription._add  (dart:async/stream_impl.dart:263:7)
#14     _SinkTransformerStreamSubscription._add  (dart:async/stream_transformers.dart:68:11)
#15     _EventSinkWrapper.add  (dart:async/stream_transformers.dart:15:11)
#16     WipDomain.eventStream.<anonymous closure>.<anonymous closure>  (package:webkit_inspection_protocol/webkit_inspection_protocol.dart:301:26)
#17     _HandlerEventSink.add  (dart:async/stream_transformers.dart:228:7)
#18     _SinkTransformerStreamSubscription._handleData  (dart:async/stream_transformers.dart:120:24)
#19     _RootZone.runUnaryGuarded  (dart:async/zone.dart:1314:10)
#20     _BufferingStreamSubscription._sendData  (dart:async/stream_impl.dart:336:11)
#21     _DelayedData.perform  (dart:async/stream_impl.dart:591:14)
#22     _StreamImplEvents.handleNext  (dart:async/stream_impl.dart:707:11)
#23     _PendingEvents.schedule.<anonymous closure>  (dart:async/stream_impl.dart:667:7)
#24     _microtaskLoop  (dart:async/schedule_microtask.dart:41:21)
#25     _startMicrotaskLoop  (dart:async/schedule_microtask.dart:50:5)
#26     _runPendingImmediateCallback  (dart:isolate-patch/isolate_patch.dart:116:13)
#27     _RawReceivePortImpl._handleMessage  (dart:isolate-patch/isolate_patch.dart:173:5)

2 个答案:

答案 0 :(得分:1)

最新的Windows SDK上的源映射存在问题。我相信根本原因是:https://github.com/dart-lang/sdk/issues/37364

请注意,有一个待解决的修补程序可以解决您的问题。

答案 1 :(得分:0)

确保还更新到最新的build_web_compilers版本-存在类似的错误,该错误已得到修复和发布,您可能会遇到该问题。