Command Palette

Search for a command to run...

dotLottie Flutter Player API Reference

API reference for the dotLottie Flutter player. Details for the DotLottieView widget, DotLottieViewController, and all supported events.

dotLottie Flutter Player API Reference

DotLottieView Widget

The DotLottieView widget renders a dotLottie or Lottie animation.

Configuration Properties

PropertyTypeDefaultDescription
sourceStringrequiredThe animation source — a URL, asset path, or JSON string.
sourceTypeStringrequiredSource type: 'url', 'asset', or 'json'.
autoplayboolfalseAuto-starts the animation on load.
loopboolfalseWhether the animation loops.
loopCountint0Number of additional loop repetitions (0 = infinite when loop is true).
speeddouble1.0Playback speed multiplier.
modeString'forward'Playback mode: 'forward', 'reverse', 'bounce', 'reverseBounce'.
segment[double, double]?nullFrame range to play as [startFrame, endFrame].
markerString?nullNamed marker to play.
useFrameInterpolationboolfalseEnable subframe interpolation.
backgroundColorString?nullBackground color as an 8-digit hex string (e.g., '#ff0000ff').
animationIdString?nullID of the animation to load from a multi-animation .lottie file.
themeIdString?nullID of the theme to apply from the .lottie file.
stateMachineIdString?nullID of the state machine to load on animation load.
widthint?nullWidth of the animation canvas.
heightint?nullHeight of the animation canvas.
onViewCreatedFunction(DotLottieViewController)?nullCallback invoked with the controller after the player is initialized.

Event Callbacks

Animation Events

CallbackSignatureDescription
onLoadVoidCallback?Fired when the animation is loaded.
onCompleteVoidCallback?Fired when playback completes.
onLoadErrorVoidCallback?Fired when loading fails.
onPlayVoidCallback?Fired when playback starts.
onPauseVoidCallback?Fired when playback pauses.
onStopVoidCallback?Fired when playback stops.
onFrameFunction(double)?Fired on each frame update.
onRenderFunction(double)?Fired when a new frame is rendered.
onLoopFunction(int)?Fired when a loop completes.

State Machine Events

CallbackSignatureDescription
stateMachineOnStartVoidCallback?Fired when the state machine starts.
stateMachineOnStopVoidCallback?Fired when the state machine stops.
stateMachineOnTransitionFunction(String from, String to)?Fired on a state transition.
stateMachineOnStateEnteredFunction(String state)?Fired when entering a state.
stateMachineOnStateExitFunction(String state)?Fired when exiting a state.
stateMachineOnCustomEventFunction(String event)?Fired when a custom state machine event is emitted.
stateMachineOnErrorFunction(String error)?Fired when the state machine encounters an error.
stateMachineOnInputFiredFunction(String inputName)?Fired when an input fires.
stateMachineOnBooleanInputValueChangeFunction(String name, bool old, bool new)?Fired when a boolean input changes.
stateMachineOnNumericInputValueChangeFunction(String name, double old, double new)?Fired when a numeric input changes.
stateMachineOnStringInputValueChangeFunction(String name, String old, String new)?Fired when a string input changes.

DotLottieViewController

Obtained via DotLottieView.onViewCreated. Provides programmatic control over the animation.

Playback Methods

MethodReturn TypeDescription
play()Future<bool?>Starts or resumes playback.
pause()Future<bool?>Pauses playback.
stop()Future<bool?>Stops playback and resets to the first frame.
setFrame(double frame)Future<bool?>Jumps to the specified frame.
setProgress(double progress)Future<bool?>Jumps to the specified progress (0.0–1.0).
setSpeed(double speed)Future<void>Sets the playback speed multiplier.
setLoop(bool loop)Future<void>Enables or disables looping.
setMode(String mode)Future<void>Sets the playback mode.
setSegments(double start, double end)Future<void>Sets the frame range to play.
setMarker(String marker)Future<void>Sets the named marker to play.
setFrameInterpolation(bool value)Future<void>Enables or disables subframe interpolation.
resize(int width, int height)Future<void>Resizes the animation canvas.

State Queries

MethodReturn TypeDescription
isPlaying()Future<bool?>Returns true if the animation is playing.
isPaused()Future<bool?>Returns true if paused.
isStopped()Future<bool?>Returns true if stopped.
isLoaded()Future<bool?>Returns true if the animation is loaded.
currentFrame()Future<double?>Returns the current frame number.
totalFrames()Future<double?>Returns the total number of frames.
currentProgress()Future<double?>Returns the current progress (0.0–1.0).
duration()Future<double?>Returns the animation duration in milliseconds.
speed()Future<double?>Returns the current playback speed.
loop()Future<bool?>Returns the current loop setting.
autoplay()Future<bool?>Returns the current autoplay setting.
loopCount()Future<int?>Returns the current loop count.
segments()Future<List<double>?>Returns the current frame segment.
mode()Future<String?>Returns the current playback mode.
useFrameInterpolation()Future<bool?>Returns whether subframe interpolation is on.

Animation & Theme

MethodReturn TypeDescription
loadAnimation(String animationId)Future<void>Loads a specific animation by ID.
activeAnimationId()Future<String?>Returns the ID of the currently active animation.
activeThemeId()Future<String?>Returns the ID of the currently active theme.
setTheme(String themeId)Future<bool?>Applies a theme by ID.
setThemeData(String themeData)Future<bool?>Applies a theme from a raw JSON string.
resetTheme()Future<bool?>Resets to the default theme.
markers()Future<List<Map<String, dynamic>>?>Returns the list of available markers.
manifest()Future<Map<String, dynamic>?>Returns the dotLottie manifest.

Slots

MethodReturn TypeDescription
setSlots(String slots)Future<bool?>Sets multiple slot values from a JSON string.

Layer Utilities

MethodReturn TypeDescription
getLayerBounds(String layerName)Future<List<double>?>Returns the bounding box of the named layer.

State Machine

MethodReturn TypeDescription
stateMachineLoad(String id)Future<void>Loads a state machine by ID.
stateMachineLoadData(String data)Future<void>Loads a state machine from a raw JSON string.
stateMachineStart()Future<void>Starts the loaded state machine.
stateMachineStop()Future<void>Stops the state machine.
stateMachineFire(String event)Future<void>Fires a named event to the state machine.
stateMachineSetBooleanInput(String key, bool value)Future<void>Sets a boolean input.
stateMachineSetNumericInput(String key, double value)Future<void>Sets a numeric input.
stateMachineSetStringInput(String key, String value)Future<void>Sets a string input.
stateMachineGetBooleanInput(String key)Future<bool?>Gets a boolean input value.
stateMachineGetNumericInput(String key)Future<double?>Gets a numeric input value.
stateMachineGetStringInput(String key)Future<String?>Gets a string input value.
stateMachineGetInputs()Future<Map>Returns all defined inputs and their values.
stateMachineCurrentState()Future<String>Returns the name of the currently active state.
getStateMachine(String id)Future<String>Returns the state machine definition JSON.
dispose()Future<void>Disposes the controller and releases resources.

Last updated: April 10, 2026 at 9:12 AMEdit this page