Dart以编程方式从.dart脚本中实例化Polymer-elements

时间:2013-11-11 21:15:41

标签: dart dart-polymer

我正在研究在dart中设置服务器 - 客户端测试应用程序。

现在服务器/客户端连接正常。我想做的其中一件事是在不同时间从页面添加和删除自定义元素。现在我有代码:

import 'dart:async';

import 'dart:convert';
import 'dart:html';
import 'Signin/sign_in.dart';
import 'package:polymer/polymer.dart';


class Client {
  static const Duration RECONNECT_DELAY = const Duration(milliseconds: 500);

  WebSocket webSocket;
  DivElement viewRoot;
  Client() {
     // Signin is a custom element defined...
    Signin sign = new Signin();
    viewRoot = $['hold-everything'];
    viewRoot.children.add(sign);


    connect();
  }
....
}

sign_in.dart

class Signin extends PolymerElement {

  Signin.created() : super.created();

  InputElement username;
  DivElement usernameParent;
  DivElement passwordParent;
  LabelElement usrWarn;
  LabelElement passWarn;
  LabelElement submissionWarn;
...
}

当我加载页面时,我收到以下错误:

    [16:08:24.480] : NoSuchMethodError : method not found: 'Symbol("constructor Signin")'
    Receiver: ""
    Arguments: [] @ http://localhost:8080/client.dart.js:1042

在client.dart中,我有以下警告

Signin sign = new Signin();
The class 'Signin' does not have a default constructor

0 个答案:

没有答案