缺少方法" null"。烟雾包的代码生成似乎不完整

时间:2014-12-16 20:58:00

标签: dart polymer dart-polymer

我在网页上使用了许多core-ajax-dart元素。触发的自定义事件似乎被打破了。当使用声明性on-core-response="{{ajaxNewProjectResponse}}"时,元素似乎想要触发自定义事件,但是有一个烟雾包的方式给出:

Missing method "null" in competences-service. Code generation for the smoke package seems incomplete.

如果我通过ajaxNewProject.onCoreResponse.listen(ajaxNewProjectResponse);强制执行,它会按预期工作(事件触发并调用我的事件方法)。

这曾经工作过。我怀疑在更新聚合物或core_elements版本时,或者当我开始使用越来越多的core-ajax-dart元素时,它可能已经崩溃。

我从烟雾包装中了解到它可能与聚合物变压器有关。该错误使我相信某些代码未正确生成,因此可能指出框架错误,而不是我的代码中的错误。我可以找到相对较少的关于此错误消息,只有https://groups.google.com/a/dartlang.org/forum/#!topic/web/INNHAZhLy1A,但我没有在代码中的字符串中隐藏表达式。我在这里走在正确的轨道上吗?

错误:

Exception: Uncaught Error: Missing method "null" in competences-service. Code generation for the smoke package seems incomplete.
Stack Trace:
#0      GeneratedObjectAccessorService.invoke (package:smoke/static.dart:127:7)
#1      invoke (package:smoke/smoke.dart:43:41)
#2      HtmlElement&Polymer.dispatchMethod (package:polymer/src/instance.dart:1138:19)
#3      BindingDelegate&PolymerEventBindings.getEventHandler.<anonymous closure> (package:polymer/src/events.dart:82:32)
#4      _RootZone.runUnaryGuarded (dart:async/zone.dart:1089)
#5      _RootZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1118)
#6      BindingDelegate&PolymerEventBindings.prepareEventBinding.<anonymous closure>.<anonymous closure> (package:polymer/src/events.dart:101:67)
#7      BlinkEventTarget.dispatchEvent_Callback_Event (dart:_blink:42)
#8      EventTarget.dispatchEvent (dart:html:13924)
#9      HtmlElement&Polymer.fire (package:polymer/src/instance.dart:1201:23)
#10     CoreAjax.processResponse (package:core_elements/core_ajax_dart.dart:208:14)
#11     receive (package:core_elements/core_ajax_dart.dart:190:27)
#12     CoreXhr._makeReadyStateHandler.<anonymous closure> (package:core_elements/core_xhr_dart.dart:107:39)

我的代码: https://github.com/pjjjv/Akepot/tree/0b093b2b9671f4ce0351750d9ce3609dfb4e82f5上的完整代码。 core-ajax-dart元素位于lib / capabilitiess_service.html中,并显示我使用声明事件处理程序将id为ajaxNewProject的bug留下的错误。

摘录: HTML:

<core-ajax-dart id="ajaxNewProject"
      url="https://1-dot-akepot-competence-matrix.appspot.com/_ah/api/akepot/v1/project/"
       on-core-response="{{ajaxNewProjectResponse}}" on-core-error="{{ajaxError}}"
      handleAs="json" method="POST">
    </core-ajax-dart>

落镖:

  void newProject(Project project){
    if(!signedin){
      throw new Exception("Not signed in.");
    }
    ajaxNewProject.url = "https://1-dot-akepot-competence-matrix.appspot.com/_ah/api/akepot/v1/project/$hash";
    ajaxNewProject.body = JSON.encode(project.toJson());
    ajaxNewProject.go();
  }

  @reflectable
  void ajaxNewProjectResponse(CustomEvent event, Map detail, CoreAjax node) {
    ...
  }

如果您运行该应用程序,请在左上角登录,单击“创建项目”,然后再次单击“创建项目”。然后检查控制台。

1 个答案:

答案 0 :(得分:0)

根据我的经验,这是因为<script/>中有多个<polymer-element/>标记。你有两个<script/>标签。是否将<script src="../../packages/browser/dart.js"></script>位移到<polymer-element/>帮助之外?