Open javaone199 opened 1 month ago
What about tree shaking though?
Can you elaborate how the icon would be identified by name? Currently, icons work with a custom font and you can use IconData
to specify an Icon by code point and font family.
The triaged-design
label is irrelevant if there is no team-design
label or fyi-design
label.
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
Reopening this as OP filed duplicate issue, as this issue was locked for conversation.
@javaone199 Please share your findings or reply on above question asked.
Add the following method to Icons class.
static IconData fromName(String iconName) { return iconMap[iconName]; }
iconName is a pre-defined constant name in Icons class.
From the IconData doc, instantiating IconData instead of using the predefined IconData constants will cause tree-shaking issue.
Use case
Icon names are retrieved from server. So a method for getting IconData from icon name is needed.
Icons.fromName(iconName)
iconName is the same as the constant name in Icons class.
pub.dev package material_icon_design_flutter does not contain many of the IconData constants defined in Icons, so it is not designed to provide name mappings for the Icons class.
Proposal
Add a new method for mapping names to IconData constants:
IconData Icons.fromName(iconName)