當我像這樣在 HashMap 中添加一些元素時:
void loadingMoreChannel(RefreshController _refreshController) async {
articleRequest.pageNum = articleRequest.pageNum 1;
List<Channel> channels = await Repo.getChannels(articleRequest);
channels.addAll(channels);
_refreshController.loadComplete();
}
第一步從服務器端獲取一些頻道資訊,然后將頻道資訊添加到串列中,顯示錯誤:
Concurrent modification during iteration: Instance(length:15) of '_GrowableList'.<…>
我應該怎么做才能將頻道元素添加到并發串列中?
uj5u.com熱心網友回復:
似乎您需要重命名變數。你可以做
void loadingMoreChannel(RefreshController _refreshController) async {
articleRequest.pageNum = articleRequest.pageNum 1;
List<Channel> result = await Repo.getChannels(articleRequest);
channels.addAll(result); //it was having same name
_refreshController.loadComplete();
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/522604.html
標籤:扑镖
