listenWhen property
ShouldProceedCallback<S> ?
listenWhen
finalinherited
Function to determine if the listener should be called when state changes.
If provided, this function is called with the previous and current state.
Return true
to call the listener, false
to skip it.
Example:
NotifierListener<CounterNotifier, int>(
listenWhen: (previous, current) => current > previous, // Only listen for increases
listener: (state) => print('Count increased to: $state'),
child: MyWidget(),
)
Implementation
final ShouldProceedCallback<S>? listenWhen;