【发布时间】:2021-06-30 13:36:07
【问题描述】:
我正在创建一种“交互式字典”。显然,字典将由 WORDS(作为条目)组成。所以我定义了“单词”是什么:一系列元素:一个主要的英语单词、一个同义词列表、一个反义词列表、法语翻译等......
到目前为止,我已经创建了一个包含所有这些字段的“WORD WIDGET”。 因此,我的 wordBank 列表将包含一个“单词小部件列表”。
我想知道这是否是一种组织数据的好方法,如果一个 MAPS 列表会更好? 在使用列表、排序、获取元素等时会不会有性能差异?
这是我构建它的方式:
enum Nature {
nom_masc,
nom_fem,
adjectif,
adverbe,
verbe,
verbe_irr,
preposition,
}
class Word {
final int id;
final Nature nature;
final String theme;
final List<String> french; // the first element is the primary word
final List<String> english; // the first element is the primary word
final String image;
final String sound; // to be used as label2 in case of input type question
final String wDef; // a written definion of the main word
final String oDef; // an oral definition of the main word
final String phon; // a phonetic transcription of the word
Word({
@required this.id,
@required this.nature,
@required this.theme,
@required this.french,
@required this.english,
this.image,
this.sound,
this.wDef,
this.oDef,
this.phon,
});
}
```
【问题讨论】:
标签: list flutter dart widget maps