lottie-flutter
lottie-flutter copied to clipboard
Unable to load asset from Lottie.asset().
Loading an asset from a file does not work. I tried with .zip and .json. There are no errors other than that in the application screen. Everything works fine with Lottie.network, but I need to load the animations from a file. I searched the internet for a long time but found no solution. I tried the old lottie versions but it didn't fix the problem.
Lottie version: lottie: ^1.4.2
Flutter doctor:
Run:
I think you either have to declare your assets without the "packages" path:
assets:
- assets/images/118839-sleeping-piggy.zip
or use the package
parameter in the Lottie.asset
constructor:
Lottie.asset('assets/images/118839-sleeping-piggy.zip', package: 'pizzaparty')
It did not help.
If I use Lottie.asset('assets/images/118839-sleeping-piggy.zip', package: 'pizzaparty')
error changes to Bad state: No element
I checked your solution again, but on .json it works!
Lottie.asset('assets/images/75816-delivering-pizzas.json', package: 'pizzaparty')
assets: - packages/pizzaparty/assets/images/75816-delivering-pizzas.json
The .zip still doesn't work, but that is a minor problem. Thanks!!
Can you send the .zip file to check why it doesn't load?