Optional predicate to determine whether to rebuild when the state changes.
If buildWhen returns true, the widget will rebuild. If null, always rebuilds.
final bool Function(S previous, S current)? buildWhen;