ThorvgController class

Method-channel-backed controller for one Lottie animation rendered into a Flutter Texture(textureId).

Replaces the legacy dart:ffi-driven Thorvg class for jank-sensitive callers. All rasterization happens on a native producer thread (per-texture HandlerThread on Android, DispatchQueue on iOS); the Flutter UI isolate only sends control messages — play, pause, seek, resize, dispose.

The controller is created via ThorvgController.create. It owns the native handle and the registered SurfaceTextureEntry / FlutterTexture behind textureId. Pass that id to a Texture(textureId: …) widget to display the output.

Properties

duration → double
Animation length in seconds.
final
hashCode → int
The hash code for this object.
no setterinherited
isDisposed → bool
True after dispose has been called or the underlying texture has been torn down by the engine. Subsequent calls become no-ops.
no setter
lottieHeight → int
final
lottieWidth → int
Native lottie composition size (from Lottie JSON w / h).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
textureId → int
Texture id to pass to a Texture widget.
final
totalFrame → double
Animation length in frames; 0 for static lottie.
final

Methods

dispose() → Future<void>
Releases the native handle, the SurfaceTexture/CVPixelBuffer pool, and the per-instance render thread. Must be called from the consuming widget's dispose.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() → Future<void>
Pauses the animation; the texture keeps its last rendered frame. Combine with VisibilityDetector to free CPU for off-screen items.
play() → Future<void>
Resumes (or starts) the animation. Idempotent.
resize(int width, int height) → Future<void>
Reallocates the native rasterization buffer to the new dimensions and renders the current frame at the new resolution.
seek(double frame) → Future<void>
Seeks to frame (a value between 0 and totalFrame) and pauses.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

create({required Uint8List data, required int width, required int height, bool animate = true, bool repeat = true, bool reverse = false, double speed = 1.0}) → Future<ThorvgController>
Creates a new texture-backed Lottie animation natively.