ฉันมีสามคลาสใน Dart ดังที่แสดงด้านล่าง:
นิดหน่อย:
part of CB_Crypto;
class Bit {
bool _state = false,
_sympathetic = false;
int _alignment = 0;
Bit(List args) {
_state = args[0];
_sympathetic = args[1];
_alignment = args[2];
}
bool state() => _state;
bool not() => _state = !_state;
bool set(bool state) => _state = state;
bool isSympathetic() => _sympathetic;
operator &(Bit b) => state() && b.state();
operator |(Bit b) => state() || b.state();
}
คำ:
part of CB_Crypto;
class Word {
List<Bit> _bits = [];
Word(List<List> bits) {
bits.forEach((bit) => _bits.add(new Bit(bit)));
}
bool not(int i) => _bits[i].not();
void notAll() => _bits.forEach((bit) => bit.not());
}
โต๊ะ:
part of CB_Crypto;
class Table {
List<Word> _words;
Word(List<List> words) {
words.forEach((word) => _words.add(new Word(word)));
}
}
ทั้งหมดนี้อยู่ในไฟล์ที่แตกต่างกันและเป็นส่วนหนึ่งของไลบรารีเดียวกัน อย่างไรก็ตาม ฉันได้รับคำเตือนจาก Dartium ในคลาส Table สำหรับการใช้ Word เป็นประเภทและพยายามสร้างอินสแตนซ์ของวัตถุ Word: the name "Word" is not a (type/class) and cannot be used as a parametrized type
ฉันเชื่อว่าฉันเขียนคลาส Word คล้ายกับคลาส Bit และนั่นไม่ทำให้เกิดข้อผิดพลาดเมื่อใช้ใน Table เนื่องจากมีการใช้ Word ฉันพลาดอะไรไปรึเปล่า?
Word(List<List> words) {
- เพื่อความเข้าใจที่ดีขึ้น คุณควรพิมพ์รายการ (ด้านใน) ให้เรา - person Robert   schedule 15.06.2014part "file.dart"
สำหรับแต่ละส่วนในห้องสมุดของคุณหรือไม่? - person Günter Zöchbauer   schedule 15.06.2014