"Converting Lists to Maps in Dart" should use literals
iapicca opened this issue · comments
43 - Converting Lists to Maps in Dart
const list = ['this','is','a','long','text'];
final map = {for (final s in list) s:s.length}; /// <= this way!
void main() {
for (final e in map.entries) {
print('"${e.key}" length is ${e.value}');
}
}