2

我在将 web_ui 添加到现有的 dart 应用程序时遇到问题。我什至没有将任何 webui 特定代码添加到我的 html 文件中,我只是在尝试构建。

我将 web_ui 添加到 pubspec.yaml 并运行 pub install。

当我运行我的 build.dart 文件时,它会生成:

Uncaught Error: type 'AttributeName' is not a subtype of type 'String' of 'name'.

这就是我的 build.dart 文件的样子(它位于我项目的根目录中):

import 'package:web_ui/component_build.dart';
import 'dart:io';

void main() {
  build(new Options().arguments, ['bin/mywebpage.html']);
}

另外值得注意的是,我尝试了他们自动生成的 webUI 示例,它可以工作,我只是无法将它添加到我现有的项目中。

编辑:

  1. 是的,通常是 index.html,但没有区别。我确实尝试过改变它。我正在运行最新版本的 Dart M4。

  2. 当我在 Dartium 中运行 mywebpage.html 时,我没有收到任何错误,但 {{dataValue}} 不会被其对应的数据替换。

  3. Dart 编辑器版本 0.4.7_r21658 Dart SDK 版本 0.4.7.5_r21658

这就是我得到的所有信息,有趣的是 clipPath 并不意外,它正在关闭一个打开的 clipPath 标签:

warning bin/mywebsite.html:86:3: Unexpected end tag (clippath). Ignored.
        </clipPath>
  ^^^^^^^^^^^
warning bin/mywebsite.html:99:3: Unexpected end tag (clippath). Ignored.
        </clipPath>
  ^^^^^^^^^^^
Uncaught Error: type 'AttributeName' is not a subtype of type 'String' of 'name'.
Stack Trace:
#0      _Analyzer.visitAttribute (package:web_ui/src/analyzer.dart:403:48)
#1      _Analyzer.visitElementInfo.<anonymous closure> (package:web_ui/src/analyzer.dart:157:53)
#2      LinkedHashMap.forEach (dart:collection-patch:241:13)
#3      _Analyzer.visitElementInfo (package:web_ui/src/analyzer.dart:157:28)
#4      _Analyzer.visitElement (package:web_ui/src/analyzer.dart:123:21)
#5      TreeVisitor.visit (package:html5lib/dom_parsing.dart:15:50)
#6      TreeVisitor.visitChildren (package:html5lib/dom_parsing.dart:27:49)
#7      TreeVisitor.visitNodeFallback (package:html5lib/dom_parsing.dart:35:48)
#8      TreeVisitor.visitElement (package:html5lib/dom_parsing.dart:44:50)
#9      _Analyzer.visitElementInfo (package:web_ui/src/analyzer.dart:175:23)
#10     _Analyzer.visitElement (package:web_ui/src/analyzer.dart:123:21)
#11     TreeVisitor.visit (package:html5lib/dom_parsing.dart:15:50)
#12     TreeVisitor.visitChildren (package:html5lib/dom_parsing.dart:27:49)
#13     TreeVisitor.visitNodeFallback (package:html5lib/dom_parsing.dart:35:48)
#14     TreeVisitor.visitElement (package:html5lib/dom_parsing.dart:44:50)
#15     _Analyzer.visitElementInfo (package:web_ui/src/analyzer.dart:175:23)
#16     _Analyzer.visitElement (package:web_ui/src/analyzer.dart:123:21)
#17     TreeVisitor.visit (package:html5lib/dom_parsing.dart:15:50)
#18     TreeVisitor.visitChildren (package:html5lib/dom_parsing.dart:27:49)
#19     TreeVisitor.visitNodeFallback (package:html5lib/dom_parsing.dart:35:48)
#20     TreeVisitor.visitElement (package:html5lib/dom_parsing.dart:44:50)
#21     _Analyzer.visitElementInfo (package:web_ui/src/analyzer.dart:175:23)
#22     _Analyzer.visitElement (package:web_ui/src/analyzer.dart:123:21)
#23     TreeVisitor.visit (package:html5lib/dom_parsing.dart:15:50)
#24     TreeVisitor.visitChildren (package:html5lib/dom_parsing.dart:27:49)
#25     TreeVisitor.visitNodeFallback (package:html5lib/dom_parsing.dart:35:48)
#26     TreeVisitor.visitDocument (package:html5lib/dom_parsing.dart:37:52)
#27     TreeVisitor.visit (package:html5lib/dom_parsing.dart:19:52)
#28     analyzeFile (package:web_ui/src/analyzer.dart:63:17)
#29     Compiler._analyze.<anonymous closure> (package:web_ui/src/compiler.dart:512:24)
#30     time (package:web_ui/src/utils.dart:46:24)
#31     Compiler._time (package:web_ui/src/compiler.dart:714:16)
#32     Compiler._analyze (package:web_ui/src/compiler.dart:511:14)
#33     Compiler.run.<anonymous closure> (package:web_ui/src/compiler.dart:110:15)
#34     _ThenFuture._sendValue (dart:async:397:24)
#35     _FutureImpl._setValue (dart:async:294:26)
#36     _CompleterImpl.complete (dart:async:129:21)
#37     FutureGroup.add.<anonymous closure> (package:web_ui/src/utils.dart:141:28)
#38     _ThenFuture._sendValue (dart:async:397:24)
#39     _FutureImpl._setValue (dart:async:294:26)
#40     _FutureImpl._setOrChainValue (dart:async:371:16)
#41     _ThenFuture._sendValue (dart:async:403:21)
#42     _FutureImpl._setValue (dart:async:294:26)
#43     _CatchErrorFuture._sendValue (dart:async:415:14)
#44     _FutureImpl._setValue (dart:async:294:26)
#45     _FutureImpl._setOrChainValue (dart:async:371:16)
#46     _ThenFuture._sendValue (dart:async:403:21)
#47     _FutureImpl._setValue (dart:async:294:26)
#48     _FutureImpl._setOrChainValue (dart:async:371:16)
#49     _ThenFuture._sendValue (dart:async:403:21)
#50     _FutureImpl._setValue (dart:async:294:26)
#51     _FutureListenerWrapper._sendValue (dart:async:157:21)
#52     _FutureImpl._setValue (dart:async:294:26)
#53     _FutureListenerWrapper._sendValue (dart:async:157:21)
#54     _FutureImpl._setValue (dart:async:294:26)
#55     _FutureImpl._setOrChainValue (dart:async:371:16)
#56     _ThenFuture._sendValue (dart:async:403:21)
#57     _FutureImpl._setValue (dart:async:294:26)
#58     _FutureListenerWrapper._sendValue (dart:async:157:21)
#59     _FutureImpl._setValue (dart:async:294:26)
#60     _FutureImpl._setOrChainValue (dart:async:371:16)
#61     _ThenFuture._sendValue (dart:async:403:21)
#62     _FutureImpl._setValue (dart:async:294:26)
#63     _CompleterImpl.complete (dart:async:129:21)
#64     _SendPortImpl.call.<anonymous closure> (dart:isolate-patch:106:27)
#65     _ReceivePortImpl._handleMessage (dart:isolate-patch:81:92)


Unhandled exception:
_FutureImpl._scheduleUnhandledError.<anonymous closure> (dart:async:325:9)
#1      Timer.run.<anonymous closure> (dart:async:2240:21)
#2      Timer.run.<anonymous closure> (dart:async:2248:13)
#3      Timer.Timer.<anonymous closure> (dart:async-patch:15:15)
#4      _Timer._createTimerHandler._handleTimeout (dart:io:6721:28)
#5      _Timer._createTimerHandler._handleTimeout (dart:io:6729:7)
#6      _Timer._createTimerHandler.<anonymous closure> (dart:io:6737:23)
#7      _ReceivePortImpl._handleMessage (dart:isolate-patch:81:92)
4

1 回答 1

0

This error message is caused by the web-ui library failing a type check. It's expecting a String but getting an AttributeName class back from html5lib.

See this issue. Are you using an xmlns attribute in your html - svg perhaps?

You could also post on the web-ui mailing list, or file a bug report.

于 2013-05-01T05:21:03.950 回答