setCompleter method Null safety

void setCompleter(
  1. 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.


void setCompleter(ImageStreamCompleter value) {
  assert(_completer == null);
  _completer = value;
  if (_listeners != null) {
    final List<ImageStreamListener> initialListeners = _listeners!;
    _listeners = null;
    _completer!._addingInitialListeners = true;
    _completer!._addingInitialListeners = false;