Flutter 1.20.1 -> cannot use tree shake icons fonts

Issue #15 resolved
Albert-Jan Plate created an issue

New future that got enabled by default in flutter 1.20.1 release.

This application cannot tree shake icons fonts. It has non-constant instances of IconData at the following locations

  • file:///XXX/hosted/pub.dartlang.org/flutter_treeview-0.5.0+1/lib/src/models/node_icon.dart:82:24

Comments (12)

  1. Sadra Shadmand

    same issue here

    This application cannot tree shake icons fonts. It has non-constant instances of IconData at the following locations:

    • file:///Users/sadra/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_treeview-0.4.2+1/lib/src/models/node_icon.dart:66:24
    • file:///Users/sadra/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_treeview-0.4.2+1/lib/src/models/node_icon.dart:82:24

  2. Kevin Armstrong

    I am working to find a solution. In the meantime, you can turn off the tree shaking by passing the build argument as follows:

    flutter build ios --no-tree-shake-icons

  3. Ricardo Sawir

    Hi @Kevin Armstrong I still encounter this issue. Has this been fixed or in the mean time still use --no-tree-shake-icons?

  4. Albert-Jan Plate reporter

    I’ve been digging into this issue a bit more because it limits my workflow to easily upload my builds to Testflight. What is the advantage of dynamically generating the NodeIcon based on a map instead of passing a regular Icon with its IconData?

  5. Albert-Jan Plate reporter

    Update: I’ve managed to modify the library to only include IconData as part of the NodeIcon instead of dynamically generating this. Not sure if you want me to create a PR or you will re-create the changes yourself.

  6. Kevin Armstrong

    I created the NodeIcon this way so that its state can be easily serialized and deserialized with the rest of the TreeView data. I know a number of users who use this feature to build the TreeView with icons directly from the server. Limiting this to just passing in the IconData would remove this capability.

    I’ve have very little time in the past few weeks to find a solution. My apologies. If you can share your solution, I can review it to see if it I can make it work.

  7. Log in to comment