graphics property

Graphics graphics

Returns the graphics object associated with this sprite. If the _graphics field is null, it is assigned a new Graphics object. This means that the graphics object is lazily initialized when it is first requested. This allows the sprite to be used without graphics until it is needed.

Implementation

Graphics get graphics {
  return _graphics ??= Graphics();
}