toggle method
Toggles the item at the given index
, expanding it if it is collapsed and vice versa.
This method should not be called while the widget tree is being rebuilt.
Implementation
Future<bool> toggle(int index) async => switch (_controllers[index]?.status) {
null => false,
final status when status.isForwardOrCompleted => await collapse(index),
_ => await expand(index),
};