onExpansionWillChange property
Called when the widget will change expanded state.
When the widget is going to start expanding/collapsing, this function is called with the value true/false.
Return false to prevent expanded state to change. Return true(default) to allow expanded state changing.
Implementation
final bool Function(bool)? onExpansionWillChange;