flutter icon indicating copy to clipboard operation
flutter copied to clipboard

Static icon classes and its members should be const

Open peer-f opened this issue 1 year ago • 4 comments

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.

peer-f avatar May 30 '23 16:05 peer-f

Downgrading to version 1.4.0 fixed the error for me and new builds ran through without issues.

peer-f avatar May 31 '23 10:05 peer-f

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

k-ane avatar Jun 15 '23 10:06 k-ane

I'm having the same issue. Hopefully we can get a new release soon.

/cc @rektdeckard

johnnyasantoss avatar Jul 05 '23 01:07 johnnyasantoss

A new 2.0.1 version has been released. you can point to pub dev now

rurickdev avatar Nov 04 '23 06:11 rurickdev