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.47k stars 146 forks source link

[FR]: Possibility to create two classes of generated assets #590

Open abikko opened 2 days ago

abikko commented 2 days ago

Is there an existing issue for this?

Describe the problem

Hello!

I created the two repos, first is UI-Kit, created assets using flutter_gen, exported assets.gen.dart file

And added to pubspec.yaml UI-Kit repo,

And I have a problem, that I have local assets in project and exported assets.gen.dart

And they both named "Assets", and Dart analyzer warns that we are importing assets.gen.dart from pubspec dependency and local assets.gen.dart

of course we have a solution with rename the local/remote repo assets.gen.dart, and rename the all occurences in project

But I wanna to do it, part by part

Describe the solution

So, I wanna recommend a solution to keep first version of assets.gen.dart, and mark it @Deprecated('Use new assets.gen.dart instead')

and create the second, with new class name, which will include new assets

Additional context

Like adding new fields in pubspec.yaml for flutter_gen block


flutter_gen:
  assets:
    outputs:
      {first_assets_class_name}:
             package_parameter_enabled: true # <- Add this line.
       {second_assets_class_name}:
       and etc
  output: lib/assets/
  integrations:
    flutter_svg: true

Code of Conduct

abikko commented 2 days ago

Or another case.

We have old UI-kit, and updated UI-kit, and we don't wanna to update all in one time. Doing it again part by part.

AlexV525 commented 2 days ago

This sounds like out of the scope of the plugin. You can put your desired annotations wherever you want but the generator will consider too much if it has to implement such a feature.