onDisposed method

  1. @override
void onDisposed()
override

Called when this ImageStreamCompleter has actually been disposed.

Subclasses should override this if they need to clean up resources when they are disposed.

Implementation

@override
void onDisposed() {
  super.onDisposed();
  _disposed = true;
  _timer?.cancel();
  _timer = null;
  _discardNextFrame();
  // Cancelling can drop a codec still being created by the producer. Drain
  // late results with static callbacks so the stream cannot retain us.
  _codecSubscription?.onData(_disposeCodec);
  _codecSubscription?.onError(_ignoreCodecError);
  _codecSubscription = null;
  _chunkSubscription?.cancel();
  _chunkSubscription = null;
  _replacePendingCodec(null);
  _codec?.dispose();
  _codec = null;
}