flutter_gen icon indicating copy to clipboard operation
flutter_gen copied to clipboard

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

Open abikko opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

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

  • [X] I agree to follow this project's Code of Conduct

abikko avatar Oct 15 '24 12:10 abikko

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.

abikko avatar Oct 15 '24 12:10 abikko

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.

AlexV525 avatar Oct 15 '24 12:10 AlexV525