bufferedTime<T> static method
Creates a BufferedTimeBeacon that collects values over a specified time duration.
Once the time duration elapses, the beacon's value is updated with the list of
collected values and the buffer is reset for the next interval.
This beacon is ideal for scenarios where values need to be batched and processed periodically over time.
Example:
var timeBeacon = BufferedTimeBeacon<int>(bufferDuration: Duration(seconds: 5));
timeBeacon.subscribe((values) {
print(values); // Outputs the list of collected values every 5 seconds
});
timeBeacon.value = 1;
timeBeacon.value = 2;
// After 5 seconds, it will output [1, 2]
Implementation
static BufferedTimeBeacon<T> bufferedTime<T>({required Duration duration}) =>
BufferedTimeBeacon<T>(duration: duration);