buildWhen property
An optional buildWhen can be implemented for more granular control over
how often TimerControllerBuilder rebuilds.
buildWhen will be invoked on each controller value
change.
buildWhen takes the previous and current value
and must
return a bool which determines whether or not the builder function will
be invoked.
The previous value
will be initialized to the value
of the controller when
the TimerControllerBuilder is initialized.
buildWhen is optional and if omitted, it will default to true
.
TimerControllerBuilder(
controller: myTimerController,
buildWhen: (previous, current) {
// return true/false to determine whether or not
// to rebuild the widget with state
},
builder: (context, value, child) {
// return widget here based on myTimerController value
}
)
Implementation
final TimerControllerBuilderCondition? buildWhen;