Svg class

A Svg to be rendered on a Flame Game.

Constructors

Svg(PictureInfo pictureInfo, {double? pixelRatio})
Creates an Svg with the received pictureInfo. Default pixelRatio is the device pixel ratio.

Properties

hashCode int
The hash code for this object.
no setterinherited
pictureInfo → PictureInfo
The PictureInfo that this Svg represents.
final
pixelRatio double
The pixel ratio that this Svg is rendered based on.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Clear all the stored cache from this SVG, be sure to call this method once the instance is no longer needed to avoid memory leaks
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
render(Canvas canvas, Vector2 size, {Paint? overridePaint}) → void
Renders the svg on the canvas using the dimensions provided by size.
renderPosition(Canvas canvas, Vector2 position, Vector2 size) → void
Renders the svg on the canvas on the given position using the dimensions provided by size.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

load(String fileName, {AssetsCache? cache, double? pixelRatio}) Future<Svg>
Loads an Svg with the received cache. When no cache is provided, the global Flame.assets is used.
loadFromString(String svgString, {double? pixelRatio}) Future<Svg>
Loads an Svg from a string.