dispose method Null safety

  1. @mustCallSuper
void dispose()
mustCallSuper">@mustCallSuper

Releases the resources used by this painter.

This should be called whenever the painter is no longer needed.

After this method has been called, the object is no longer usable.

Implementation

@mustCallSuper
void dispose() {
  _imageStream?.removeListener(ImageStreamListener(
    _handleImage,
    onError: _details.onError,
  ));
  _image?.dispose();
  _image = null;
}