collapse method
Collapses the item at the given index
, returning true if successfully collapsed.
This method should typically not be called while the widget tree is being rebuilt.
Implementation
Future<bool> collapse(int index) async {
if (controllers[index] == null || _expanded.length <= _min || !_expanded.contains(index)) {
return false;
}
_expanded.remove(index);
await _controllers[index]!.reverse();
notifyListeners();
return true;
}