flutter
flutter copied to clipboard
Static icon classes and its members should be const
Hello, thanks for the great set of icons!
I've noticed that different types of icons have been put into separate classes as static members of the abstract class PhosphorIcons
since I've upgraded to version 2.0.0
which is really nice.
My latest builds failed for a reason that I believe is related to the way PhosphorIcons are accessed.
Error (Xcode): This application cannot tree shake icons fonts. It has non-constant instances of IconData at the following locations:
Since each class and its members are auto generated and do not change at any time I believe both classes such as PhosphorIconsBold()
and all of it's members could and should be const. This way each icon could be accessed in a constant way which improves performance.
Downgrading to version 1.4.0
fixed the error for me and new builds ran through without issues.
This is has been fixed I believe https://github.com/phosphor-icons/flutter/issues/16 but no new release has been done since. You can also point to master which is what I am doing for the time being:
# phosphor_flutter: ^2.0.0
phosphor_flutter:
git:
url: https://github.com/phosphor-icons/flutter.git
I'm having the same issue. Hopefully we can get a new release soon.
/cc @rektdeckard
A new 2.0.1 version has been released. you can point to pub dev now