[英]List<String> not fully mapped to String in dart
Input:输入:
var message= constants.institutions['colleges'].map((e) => '$e : $count');
print(message);
Output: Output:
(School of Excellence : 110, Boarding School : 254, High School : 1660, ..., Higher Secondary School : 512, KG : 750)
I'm trying to log list of schools and student strength (for example).我正在尝试记录学校列表和学生实力(例如)。 It's 25 schools.这是25所学校。 Unfortunately it's printing ...
instead of other schools不幸的是它正在印刷...
而不是其他学校
message
here is an Iterable<String>
because .map()
returns an Iterable
.这里的message
是一个Iterable<String>
因为.map()
返回一个Iterable
。 If you want to see the full output you can do something like:如果您想查看完整的 output 您可以执行以下操作:
final message = constants.institutions['colleges'].map((e) => '$e : $count').toList();
// convert to a list
print(message); // will now print all elements
or或者
print(message.join('\n')); // join strings with a newline between each
Your data is mapping correctly.您的数据映射正确。 You are getting ...
in output because your data is very large.你得到...
在 output 因为你的数据非常大。 If you try to map and print a large amount of data in Flutter, it just prints the first and last part of the data.如果你尝试 map 并在 Flutter 中打印大量数据,它只是打印数据的第一部分和最后一部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.