[flutter_tools] enable tree-shake-icons by default for non-web targets#56633
Conversation
dnfield
left a comment
There was a problem hiding this comment.
LGTM
To include some of our offline discussion:
This can happen if kernel compilation with AOT and TFA still has const IconData references to a font that is not being bundled with the application - e.g. a package that tries to dynamically switch between Material and Cupertino icons, but the application does not include the Cupertino icon font. While it is possible that this will cause runtime issues, things are no worse in this case than they would be without the icon shaking, since either way the developer is chosing to not include the font with the bundle. It is also possible that an application will load the font dynamically at runtime, e.g. by downloading it from the web.
We discussed trying to provide a better error message here that tells you line/package numbers for the const reference. Unfortunately, the AST nodes we get from package:kernel do not provide good linkages there, and it's not even clear if that would be possible with const cannonicalization. Thus, we'll just log a status when the font is missing.
|
最新版本的sdk 打包错误 说是非常量实例,可有解决办法 |
|
Based on what Google translate tells me, the question is:
The solution is to either use --no-tree-shake-icons or to avoid using non-constant instances of IconData :) |
|
谢谢,flutter 很棒 |
Description
Enable tree-shake-icons by default for non-web targets. Make missing fonts a status print