FlutterGen / flutter_gen

The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.
https://pub.dev/packages/flutter_gen
MIT License
1.44k stars 142 forks source link

[FR]: Support Asset Transformation #514

Closed josh-burton closed 1 month ago

josh-burton commented 1 month ago

Is there an existing issue for this?

Describe the problem

Flutter 3.22.0 now supports asset transformation. This allows, for example a .svg to be transformed into a .vec.

https://docs.flutter.dev/ui/assets/asset-transformation

Describe the solution

Support a way to generate asset classes that point to the transformed asset rather than the raw asset

Additional context

No response

Code of Conduct

AlexV525 commented 1 month ago

As examples are shown in the doc, resolving how transformers handled assets would be overwhelming. To use the asset in different loaders with flutter_gen, simply use its path should be able to compatible with Asset Transformations. In this case, the package will not add additional support for the feature. Feel free to add inputs to my opinion.

AlexV525 commented 1 month ago

Closing as above suggestion. Feel free to leave any further thoughts in the thread.

Conrad33 commented 2 weeks ago

I think this should be reopened. The proposed solution:

simply use its path should be able to compatible with Asset Transformations

Isn't possible because flutter_gen can't parse the pubspec.yaml when using asset transformations. It gives an error: There is a problem with "assets". type 'YamlMap' is not a subtype of type 'String' in type cast

This is similar to #494.

AlexV525 commented 2 weeks ago

This is similar to #494.

So let's track the on that issue, thanks for the reference.

myxzlpltk commented 2 weeks ago

Yes, that error blocking the code generation. Its okay if fluttergen cannot generate that. The package can skip it and I still can call direct path