onRising static method
LxWorker<bool>
onRising(
- LxReactive<
bool> source, - void callback(), {
- dynamic onProcessingError(
- Object error,
- StackTrace stackTrace
Triggers callback only when source transitions from false to true.
Implementation
static LxWorker<bool> onRising(
LxReactive<bool> source,
void Function() callback, {
Function(Object error, StackTrace stackTrace)? onProcessingError,
}) {
var previous = source.value;
return LxWorker<bool>(
source,
(value) {
final didRise = !previous && value;
previous = value;
if (didRise) callback();
},
onProcessingError: onProcessingError,
);
}