admin管理员组文章数量:1122846
creating a list view from an API pull, the there is a number of tests, from each test we test get how many answers are correct we given the students answer and the correct answer then you much say what they student got and weather they passed or failed on a list view. below is my try, it works but it makes the ui very slow to load the page. I load the full dataset into allTest map.
ListView.builder( itemCount: No_of_tests,
itemBuilder: (BuildContext context, int i) {
totalAnswers = allTests['Test $i']!
.entries
.where(
(element) {
return element.value['ans'] == element.value['yourAns'];
},
)
.toList()
.length;
results = (totalAnswers / totalquestions) * 100;
results >= 80 ? pass = 'Passed' : pass = 'Failed';
return text('$results - $pass');
}
本文标签:
版权声明:本文标题:android - App slow due to iterating multiple times, need an alternative - flutter pull from api - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736285097a1927387.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论