getEvents method Null safety

Stream<SynthizerEvent> getEvents(
  1. {Duration duration = Duration.zero}
)

Get a stream of events.

A pause of duration will be awaited between polling for events.

Implementation

Stream<SynthizerEvent> getEvents({
  final Duration duration = Duration.zero,
}) async* {
  while (synthizer.wasInit) {
    final event = getEvent();
    if (event != null) {
      yield event;
    }
    await Future<void>.delayed(duration);
  }
}