fluttercommunity / font_awesome_flutter

The Font Awesome Icon pack available as Flutter Icons
Other
834 stars 236 forks source link

Executing "configurator.bat --dynamic" creates name_icon_mapping.dart with error #188

Closed tarafat closed 2 years ago

tarafat commented 2 years ago

Could not format because the source could not be parsed:

line 7194, column 36 of lib\name_icon_mapping.dart: Expected to find '('. ╷ 7194 │ 'overline': const FontAwesomeIcons.duotoneOverline, │ ^^^^^^^^^^^^^^^ ╵ line 7120, column 44 of lib\name_icon_mapping.dart: Expected to find '('. ╷ 7120 │ 'meh-rolling-eyes': const FontAwesomeIcons.duotoneMehRollingEyes, │ ^^^^^^^^^^^^^^^^^^^^^ ╵ line 7567, column 41 of lib\name_icon_mapping.dart: Expected to find '('. ╷ 7567 │ 'star-shooting': const FontAwesomeIcons.duotoneStarShooting, │ ^^^^^^^^^^^^^^^^^^^ ╵ line 6826, column 43 of lib\name_icon_mapping.dart: Expected to find '('. ╷ 6826 │ 'grin-beam-sweat': const FontAwesomeIcons.duotoneGrinBeamSweat, │ ^^^^^^^^^^^^^^^^^^^^ ╵ line 6678, column 34 of lib\name_icon_mapping.dart: Expected to find '('. ╷ 6678 │ 'faucet': const FontAwesomeIcons.duotoneFaucet, │ ^^^^^^^^^^^^^ ╵ line 6390, column 41 of lib\name_icon_mapping.dart: Expected to find '('. ╷ 6390 │ 'chart-pie-alt': const FontAwesomeIcons.duotoneChartPieAlt, │ ^^^^^^^^^^^^^^^^^^ ╵ line 7344, column 36 of lib\name_icon_mapping.dart: Expected to find '('. ╷ 7344 │ 'repeat-1': const FontAwesomeIcons.duotoneRepeat1, │ ^^^^^^^^^^^^^^ ╵ line 6527, column 41 of lib\name_icon_mapping.dart: Expected to find '('. ╷ 6527 │ 'compress-wide': const FontAwesomeIcons.duotoneCompressWide, │ ^^^^^^^^^^^^^^^^^^^ ╵ line 6752, column 33 of lib\name_icon_mapping.dart: Expected to find '('. ╷ 6752 │ 'flute': const FontAwesomeIcons.duotoneFlute, │ ^^^^^^^^^^^^ ╵ line 7497, column 40 of lib\name_icon_mapping.dart: Expected to find '('. ╷ 7497 │ 'snowboarding': const FontAwesomeIcons.duotoneSnowboarding, │ ^^^^^^^^^^^^^^^^^^^ ╵ (1842 more errors...)

gslender commented 2 years ago

Me too... what's up with that?

gslender commented 2 years ago

Sorted it...

Remove the 'const' from the following line 307 in util/lib/main.dart

      output.add("'${icon.name}': const FontAwesomeIcons.$iconName,");
michaelspiss commented 2 years ago

Thanks @gslender, I pushed a fix. No idea how that const got there, it makes absolutely zero sense

gslender commented 2 years ago

Are you able to run the flutter lints on the generated file?? as I believe it has other incorrect code that compiles, but fails dart lint analysis according to flutter dev guides

michaelspiss commented 2 years ago

name_icon_mapping.dart has no lint messages at all for me. The only lint messages are due to duplicate const keywords in font_awesome_flutter.dart, the usage of print() in the configurator (which can be ignored imho) and some "missing" const keywords for const constructors. Neither of those messages are errors, but only "info"

gslender commented 2 years ago

Agree but also disagree. The unnecessary const is one example that you can simply just remove from the generator. For me, this clutters the lint analysis because I use custom packages for Pro and its highly annoying to have this pollute the app. Is it really a big deal to remove unnecessary const keywords that are technically incorrect use of the language...

Every new Flutter app now turns the flutter linter on by default, and when you use this library with Pro icons, you get 1,000s of warnings about poor style.. just annoying and fairly easy to add the linter and fix these.

Much like having a line that is int a= 1; int b =a; int c= b; all technically fine but obviously poor programming to leave like that.

gslender commented 2 years ago

There is also lint issues in fa_duotone_icon.dart and fa_icon.dart

michaelspiss commented 2 years ago

I only have a limited amount of time to work on this project, so I mainly focus on popular or breaking problems. Because this hasn't been discovered in over three years since this package has been released - whilst easy to fix - it is not high on my priority list. However, I'd be more than happy to merge a pull request should you be willing to work on this!

gslender commented 2 years ago

Done!