我正在努力在 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();
}
....
}
登录.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