flutter_gen icon indicating copy to clipboard operation
flutter_gen copied to clipboard

Feature Request: Lottie files

Open vintage opened this issue 5 years ago • 3 comments

Hey there!

Would be great to have integration for the lottie files (through https://pub.dev/packages/lottie). Right now in the project I'm working on we're using the syntax:

Lottie.asset(Assets.animations.animationName)

but would be lovely to achieve it just like for the SVG files through the generated code:

Assets.animations.animationName.lottie()

The trickiest part would be probably to distinguish lottie files from non-lottie files, as it uses .json as the file extension?

vintage avatar Oct 19 '20 12:10 vintage

@wasabeef would you be interested in a PR for this?. I am using flutter_gen in a project and I would like to generate lottie assets with it.

I think the implementation is almost straight forward, the only thing is the file extension .json is very vague. I was thinking to only support files with the name *_lottie.json. What do you think about it?

jamesblasco avatar Nov 11 '21 11:11 jamesblasco

@wasabeef would you be interested in a PR for this?. I am using flutter_gen in a project and I would like to generate lottie assets with it.

I think the implementation is almost straight forward, the only thing is the file extension .json is very vague. I was thinking to only support files with the name *_lottie.json. What do you think about it?

I think it's a good idea. Please implement it.

nguyenvinhtien28 avatar Jun 10 '22 04:06 nguyenvinhtien28

This issue has been fixed ~a year ago.

As for https://github.com/FlutterGen/flutter_gen/issues/47#issuecomment-966241081 the implementation finds all .json files that contain a json object with specific keys and a version of > 4.4.0. This can still lead to false positives, but seems rare.

bramp avatar Oct 14 '23 05:10 bramp