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.13k stars 197 forks source link

.lottie file not working on iOS #355

Open sinhpn92 opened 1 month ago

sinhpn92 commented 1 month ago

Hello,

I tried to run the lottie file on iOS. It's working with the .json file, but the.lottie file is not. I get the error message about parser:

Screenshot 2024-05-31 at 17 03 05

Is there anyone with the same issue here? Does anyone have any suggestions to solve it?

Thank you so much.

ErdoganAbdullah commented 4 days ago

class Loading extends StatefulWidget { const Loading({super.key}); final bool repeat; @override State createState() => _LoadingState(); } class _LoadingState extends State with TickerProviderStateMixin { Future<LottieComposition?> customDecoder(List bytes) { return LottieComposition.decodeZip(bytes, filePicker: (files) { return files.firstWhere( (f) => f.name.startsWith(‘animations/‘) && f.name.endsWith(‘.json’)); }); } @override Widget build(BuildContext context) { return Lottie.asset(AssetsConstants.loadingLottie, decoder: customDecoder, frameRate: FrameRate.max, ); } }