setSectionCollapsed method
Future<void>
setSectionCollapsed(
- CatalogQueueSection section,
- bool collapsed
)
Implementation
Future<void> setSectionCollapsed(CatalogQueueSection section, bool collapsed) async {
final next = Set<CatalogQueueSection>.from(_collapsedSections);
if (collapsed) {
next.add(section);
} else {
next.remove(section);
}
if (next.length == _collapsedSections.length && next.containsAll(_collapsedSections)) {
return;
}
_collapsedSections = next;
notifyListeners();
final storage = await DefaultKeyValueStorage.getInstance();
await storage.setStringList(
_catalogCollapsedSectionsStorageKey,
_collapsedSections.map((item) => item.storageValue).toList()..sort(),
);
}