setCompleter method

void setCompleter (ImageStreamCompleter value)

Assigns a particular ImageStreamCompleter to this ImageStream.

This is usually done automatically by the ImageProvider that created the ImageStream.

This method can only be called once per stream. To have an ImageStream represent multiple images over time, assign it a completer that completes several images in succession.

Implementation

void setCompleter(ImageStreamCompleter value) {
  assert(_completer == null);
  _completer = value;
  if (_listeners != null) {
    final List<_ImageListenerPair> initialListeners = _listeners;
    _listeners = null;
    for (_ImageListenerPair listenerPair in initialListeners) {
      _completer.addListener(
        listenerPair.listener,
        onError: listenerPair.errorListener,
      );
    }
  }
}