2
即时尝试扩展Dart中的列表并在此列表中使用另一个类。Dart:我不能在另一个类中实例化一个类
这里是我的榜样与评论哪里出了问题:
import "Radio.dart"; // <= if i delete the Test class this import is unused for some reason
import "dart:collection";
class Test {
Radio radio = new Radio(1, null, null, null); // <= works as expected
}
class RadioList<Radio> extends ListBase<Radio> {
List<Radio> radioList = new List();
int get length => radioList.length;
void set length(int length) {
radioList.length = length;
}
void operator []=(int index, Radio value) {
radioList[index] = value;
}
Radio operator [](int index) => radioList[index];
Radio radio = new Radio(1, null, null, null); // <= Error: The name Radio is not a class
}
不幸的是我不知道为什么会这样。
在此先感谢。
谢谢!奇迹般有效。 – arkhon