Lottie class

A Lottie/JSON animation rendered by the native thorvg engine into a Flutter Texture(textureId).

Rasterization runs on a per-instance native thread (HandlerThread on Android, DispatchQueue on iOS) so the Flutter UI isolate is never blocked by SwCanvas::draw. The widget's build cost is the cost of a Texture widget — effectively a sampler — independent of how many animations are on screen.

Inheritance

Constructors

Lottie({Key? key, required Future<String> data, required double width, required double height, required bool animate, required bool repeat, required bool reverse, double renderScale = 1.0, void onLoaded(ThorvgController controller)?})
const

Properties

animate bool
final
data Future<String>
final
hashCode int
The hash code for this object.
no setterinherited
height double
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onLoaded → void Function(ThorvgController controller)?
Invoked once the native handle and texture are ready. Use the supplied ThorvgController to drive play/pause/seek/resize. The controller is owned by the widget and disposed automatically.
final
renderScale double
Multiplier applied to the logical widget size when sizing the native rasterization buffer. The thorvg SwCanvas runs on the CPU, so cost scales with rendered pixel count.
final
repeat bool
final
reverse bool
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
width double
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<Lottie>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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

Static Methods

asset(String name, {Key? key, double? width, double? height, bool? animate, bool? repeat, bool? reverse, double? renderScale, AssetBundle? bundle, String? package, void onLoaded(ThorvgController)?}) Lottie
file(File file, {Key? key, double? width, double? height, bool? animate, bool? repeat, bool? reverse, double? renderScale, void onLoaded(ThorvgController)?}) Lottie
memory(Uint8List bytes, {Key? key, double? width, double? height, bool? animate, bool? repeat, bool? reverse, double? renderScale, void onLoaded(ThorvgController)?}) Lottie
network(String src, {Key? key, double? width, double? height, bool? animate, bool? repeat, bool? reverse, double? renderScale, void onLoaded(ThorvgController)?}) Lottie