dispose method Null safety

void dispose()

Call this method to signal the ImageStreamCompleter that it can now be disposed when its last listener drops.

This method must only be called once per object.

Implementation

void dispose() {
  assert(_completer != null);
  assert(_completer!._keepAliveHandles > 0);
  assert(!_completer!._disposed);

  _completer!._keepAliveHandles -= 1;
  _completer!._maybeDispose();
  _completer = null;
}