真的令人困惑的错误:类型'屏幕'不是'功能结果'类型'屏幕'的子类型 [英] Really confusing error: type 'Screen' is not a subtype of type 'Screen' of 'function result'
问题描述
类型'屏幕'不是一个子类型键入功能结果的屏幕。
我真的不知道实际的错误是什么?
我的代码如下:
类CanvasManager {
Map< String,Screen& _canvases = new Map< String,Screen>();
CanvasManager(Map< String,CanvasElement> reqCanvas,int sizeX,int sizeY,bool fullscreen){
reqCanvas.forEach((k,v){
_canvases [k] create(v,sizeX,sizeY,fullscreen);
});
}
屏幕getCanvas(String c){
if(_canvases.containsKey(c)){
return _canvases [c];
}
else throw没有这样的画布与键$ {c};
}
}
由于某种原因,错误。
只是为了注释屏幕
是我也创建了一个类。因为我完全不知道,我不知道它是否会帮助你通过给你这个类。它有点长,所以我会粘贴bin: http://pastebin.com/KvZ54yPe
修复了它!
屏幕已经是dart:html中的类名。编译器真的应该告诉你,如果你已经重用了一个类名称与某种警告,但它不。
Hi I am writing a Dart app and I am getting the error:
type 'Screen' is not a subtype of type 'Screen' of 'function result'.
I have literally no idea what the actual error is?
My code is as follows:
class CanvasManager {
Map<String, Screen> _canvases = new Map<String, Screen>();
CanvasManager (Map<String, CanvasElement> reqCanvas, int sizeX, int sizeY, bool fullscreen) {
reqCanvas.forEach((k,v) {
_canvases[k] = new Screen.create(v, sizeX, sizeY, fullscreen);
});
}
Screen getCanvas(String c) {
if (_canvases.containsKey(c)) {
return _canvases[c];
}
else throw "No such canvas with key ${c}";
}
}
For some reason when I instance that class I get the error.
Just to note Screen
is a class I have also created. As I'm completely baffeled I don't know if it will help you by giving you that class as well. It's somewhat long so I will paste-bin it: http://pastebin.com/KvZ54yPe
Fixed it!
Screen is already a class name in dart:html. The compiler really should tell you if you have reused a class name with some sort of warning but it doesn't.
这篇关于真的令人困惑的错误:类型'屏幕'不是'功能结果'类型'屏幕'的子类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!