safeAddAll method
Adds all events from events to this controller.
If throttleDuration is provided, each event is delayed by that
duration to help avoid overwhelming downstream listeners.
Returns the number of events successfully added.
Implementation
Future<int> safeAddAll(
Iterable<T> events, {
Duration? throttleDuration,
}) async {
var count = 0;
for (final event in events) {
if (safeAdd(event)) {
count++;
if (throttleDuration != null) {
await throttleDuration.delayed<void>();
}
}
}
return count;
}