populateCache method
Builds and caches widgets for any new items not yet in the cache.
Implementation
void populateCache(BuildContext context, Iterable<ItemState> items) {
var index = 0;
for (var itemState in items) {
final itemId = toID(index++, itemState);
if (!_cachedWidgets.containsKey(itemId)) {
_cachedWidgets[itemId] = builder(
context,
store.scope(
toLocalState: (globalState) {
try {
return getIterable(globalState).firstWhereIndexed((index, element) => toID(index, element) == itemId);
} catch (e) {
return itemState;
}
},
toGlobalAction: (ItemAction localAction) => embedAction(
itemId,
localAction,
),
),
itemId,
index,
items.length,
);
}
}
}