dispose method Null safety

void dispose()

Release the resources used by this object. The object is no longer usable after this method is called.

The underlying memory allocated by this object will be retained beyond this call if it is still needed by another object that has not been disposed. For example, an ImageDescriptor that has not been disposed may still retain a reference to the memory from this buffer even if it has been disposed. Freeing that memory requires disposing all resources that may still hold it.

Implementation

void dispose() {
  assert(() {
    assert(!_debugDisposed);
    _debugDisposed = true;
    return true;
  }());
  _dispose();
}