void
refresh(- List products,
- dynamic productPreferences,
- dynamic userPreferences
)
Implementation
void refresh(
final List<Product> products,
final ProductPreferences productPreferences,
final UserPreferences userPreferences,
) {
final List<MatchedProduct> allProducts = MatchedProduct.sort(
products,
productPreferences,
userPreferences,
);
_categorizedProducts.clear();
_categorizedProducts[MatchTab.ALL] = allProducts;
for (final MatchedProduct matchedProduct in allProducts) {
final MatchTab matchTab = _getMatchTab(matchedProduct);
if (_categorizedProducts[matchTab] == null) {
_categorizedProducts[matchTab] = <MatchedProduct>[];
}
_categorizedProducts[matchTab]!.add(matchedProduct);
}
}