core library

The pure-Dart half of lottie_fixup: fixes for common issues in Lottie files exported from After Effects via Bodymovin, with no dependency on Flutter. Import this (instead of package:lottie_fixup/lottie_fixup.dart) from code that must run under plain dart run — a CLI tool or a script with no Flutter engine attached — since the main library also exports fixupLottieDecoder, which pulls in package:lottie and therefore dart:ui.

Classes

BakeOptions
BakeResult
Result of baking loop expressions in one document.
Diagnosis
Report of issues found in a Lottie document, without fixing anything.
FixResult
Combined result of running all fixes on a document.
PropertyBakeResult
Result of baking property expressions in one document.
SanitizeResult
Result of one sanitizeCrashingLayers call.

Constants

audioLayerType → const int
Lottie layer type for audio layers ("ty": 6).
loopGap → const double
Gap (in frames) left between the end of one loop and the start of the next, used for an open 'cycle' loop (first and last value differ) whose value must jump back to the start.

Functions

bakeLoopExpressions(Map<String, dynamic> doc) BakeResult
Walks doc and bakes every supported loopOut/loopIn expression found, mutating doc in place. Safe to call repeatedly: a document with no more expressions is a no-op.
bakePropertyExpressions(Map<String, dynamic> doc, {BakeOptions options = const BakeOptions()}) PropertyBakeResult
Walks doc and bakes every supported non-loop expression found, mutating doc in place. Meant to run after bakeLoopExpressions in the same document, so loop expressions it already handled are gone by the time this pass sees the tree.
diagnose(String rawJson, Map<String, dynamic> doc, {BakeOptions options = const BakeOptions()}) Diagnosis
Inspects a decoded Lottie doc (and its rawJson source) without changing anything. Pass the same options you intend to call fix with so this reports exactly what that call would (or wouldn't) bake — see BakeOptions.
fix(Map<String, dynamic> doc, {BakeOptions options = const BakeOptions()}) FixResult
Runs every fix on doc in place: strips crashing/dead layers and prunes assets left unreferenced by that, bakes any loopOut/loopIn expression into real keyframes, then bakes any remaining supported expression on a never-keyframed or already-keyframed property. Safe to call repeatedly.
sanitizeCrashingLayers(Map<String, dynamic> doc) SanitizeResult
Removes crashing/dead layers, assets, masks, and shape content from doc in place, and prunes assets left unreferenced by that removal.