Stream<T> delay(Duration duration) async* { await for (final event in this) { await Future<void>.delayed(duration); yield event; } }