ToggleSheetDelegate<T>.func constructor
ToggleSheetDelegate<T>.func (
- T? function(
- ToggleSheetController controller
Creates a ToggleSheetDelegate using a custom function that takes a ToggleSheetController
and returns an optional value of type T. This allows for dynamic control of the sheet's behavior
based on the controller's state.
The function parameter is a callback that receives the current ToggleSheetController
and returns a value of type T or null.
⚠️ Important: You should create this delegate outside the widget's build method —
ideally as a final field in a State class, or within a view model or other persistent scope.
Avoid constructing it inline within build() to ensure consistency and performance.
Returns an instance of ToggleSheetDelegateFunction with the provided function.
Implementation
factory ToggleSheetDelegate.func(
T? Function(ToggleSheetController controller) function) =>
ToggleSheetDelegateFunction<T>(function: function);