问题
I am having problems adding web_ui to my existing dart application. I haven't even added any of the webui specific code to my html file, i'm just trying to build.
I added the web_ui to pubspec.yaml and ran pub install.
When i run my build.dart file, it generates:
Uncaught Error: type 'AttributeName' is not a subtype of type 'String' of 'name'.
This is what my build.dart file looks like (it is in root dir of my project):
import 'package:web_ui/component_build.dart';
import 'dart:io';
void main() {
build(new Options().arguments, ['bin/mywebpage.html']);
}
Also worth noting, i tried their auto generated webUI example and it works, i just cant add it to my existing project.
EDIT:
Yes, usually it is index.html, but it makes no difference. I did try changing it. i am running the latest version of Dart M4.
When i run mywebpage.html in Dartium i get no errors, but {{dataValue}} is not replaced with its coresponding data.
Dart Editor version 0.4.7_r21658 Dart SDK version 0.4.7.5_r21658
This is all the info I am getting, the funny thing is clipPath is not unexpected, it is closing a opened clipPath tag :
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)
回答1:
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.
来源:https://stackoverflow.com/questions/16080115/dart-webui-build-error