toggle method
Convenience method for toggling the current expansion status.
This method should typically not be called while the widget tree is being rebuilt.
Implementation
Future<bool> toggle(int index) async => switch (controllers[index]?.value) {
null => false,
1 => await collapse(index),
_ => await expand(index),
};