xvrh / lottie-flutter

Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player.
https://pub.dev/packages/lottie
MIT License
1.15k stars 197 forks source link

Feature #290

Open thomtomdup opened 1 year ago

thomtomdup commented 1 year ago

Hello. Does it or may be could it be possible to set Lottie animation with a json String value coming from programming and not from json file ? Thank you. :)

xvrh commented 1 year ago

Currently this is not really supported and you have to workaround by re-encodind your string into a list of byte:

  var rawJsonString = '{"v":"5.1.16","fr":60...}';
  var bytes = utf8.encode(rawJsonString);
  LottieComposition.fromBytes(Uint8List.fromList(bytes));

Long term I would like to support this better.