flutter_gen icon indicating copy to clipboard operation
flutter_gen copied to clipboard

[Feature Request] Autogenerate List with assets in class

Open jamesblasco opened this issue 3 years ago • 2 comments

We have around 50 icons in our app and we would like to autogenerate a value getter that returns a list of all the assets in the class

class $AssetsIconsGen {
  const $AssetsIconsGen();

  /// File path: assets/icons/arrow_down.svg
  SvgGenImage get arrowDown => const SvgGenImage('assets/icons/arrow_down.svg');

  /// File path: assets/icons/arrow_left.svg
  SvgGenImage get arrowLeft => const SvgGenImage('assets/icons/arrow_left.svg');

  List<SvgGenImage> get svgAssets =>  [arrowDown, arrowLeft];
}

The reason is that we have an internal design component library app that displays all the icons together

jamesblasco avatar Jan 06 '22 10:01 jamesblasco

Also looking for this feature! In our project we have 100+ icons and I want a page with a list of currently imported icons with its names. Looking thru files is not always an option or a convenient one for svg on macOS (you basically have to convert em all to PNGs to view adequately sized previews). 'dart:mirrors' is no longer available, so it's hard to simply list all available fields of a class. So it would be a perfect solution to have an option in flutter_gen itself (or as a default behaviour) to also generate a list while there.

vsly-ru avatar Jun 21 '22 07:06 vsly-ru

@wasabeef any updates on this feature or the PR?

JulianBissekkou avatar Jul 05 '22 07:07 JulianBissekkou