reportImageChunkEvent method Null safety

  1. @protected
void reportImageChunkEvent(
  1. ImageChunkEvent event
)
protected">@protected

Calls all the registered ImageChunkListeners (listeners with an ImageStreamListener.onChunk specified) to notify them of a new ImageChunkEvent.

Implementation

@protected
void reportImageChunkEvent(ImageChunkEvent event) {
  _checkDisposed();
  if (hasListeners) {
    // Make a copy to allow for concurrent modification.
    final List<ImageChunkListener> localListeners = _listeners
        .map<ImageChunkListener?>((ImageStreamListener listener) => listener.onChunk)
        .whereType<ImageChunkListener>()
        .toList();
    for (final ImageChunkListener listener in localListeners) {
      listener(event);
    }
  }
}