toggleGroup method
Toggle the expansion state of a group.
Implementation
void toggleGroup(String groupId) {
final current = state;
final isExpanded = current.expandedGroupIds.contains(groupId);
if (isExpanded) {
state = current.copyWith(
expandedGroupIds:
current.expandedGroupIds.where((id) => id != groupId).toList(),
);
} else {
state = current.copyWith(
expandedGroupIds: [...current.expandedGroupIds, groupId],
);
}
}