Skip to content

Icons not rendered in release builds after 4.2928.0 (IconData subclass removal breaks tree shaking) #46

Closed

Description

@reedom

Summary

Icons from material_symbols_icons are not rendered in release builds starting with version 4.2928.0. Version 4.2906.0 works correctly.

Root cause

Commit 3324ed64 ("Updated to 2.928 of official fonts, removed use of IconData extensions as IconData is now final and cant be extended") deleted IconDataOutlined, IconDataSharp, and IconDataRounded subclasses and switched to plain const IconData(...) constructors.

Flutter's icon tree shaker uses ConstFinder to scan the compiled Dart kernel for const IconData(...) instances, extracting codePoint, fontFamily, and fontPackage to determine which glyphs to keep in each font file. With the subclass approach in 4.2906.0, fontFamily and fontPackage were baked into the subclass constructor, making them visible to ConstFinder. After the switch to plain IconData, the tree shaker appears unable to associate codepoints with the Material Symbols font files, resulting in all glyphs being stripped.

Build output confirms:

Font asset "MaterialSymbolsOutlined.ttf" was tree-shaken, reducing it from 8698948 to 2380 bytes (100.0% reduction).
Font asset "MaterialSymbolsRounded.ttf" was tree-shaken, reducing it from 14967396 to 2632 bytes (100.0% reduction).
Font asset "MaterialSymbolsSharp.ttf" was tree-shaken, reducing it from 8698948 to 2380 bytes (100.0% reduction).

100% reduction means all icon glyphs were removed, leaving blank icons at runtime.

Reproduction

  1. Create a Flutter app using material_symbols_icons: 4.2928.0
  2. Use any Symbols.* icon (e.g., Icon(Symbols.search))
  3. Build a release APK: flutter build apk --release
  4. Install on a device — icons are blank

Pinning to 4.2906.0 resolves the issue.

Environment

  • Flutter 3.41.4 (stable)
  • Dart 3.11.1
  • Tested on Huawei P20 lite (ANE-LX2J), Android

Workaround

Pin the package to 4.2906.0 in pubspec.yaml:

material_symbols_icons: 4.2906.0

Activity

  1. Javernaver commented on Mar 31, 2026

    @Javernaver

    same for me, tested on motorola edge 50 ultra and some icons are not showing in release mode

  2. timmaffett commented on Mar 31, 2026

    @timmaffett
    Owner

    Unfortunately we had to make this change because of commit flutter/flutter@5940fcf
    (And issues flutter/flutter#181342 and flutter/flutter#181344 )

    and I thought I had implemented the solution properly.. obviously not.. LOL

    I am under a deadline at work, so it will be later tonight/tomorrow before I can look at this..

    -tim

  3. timmaffett commented on Mar 31, 2026

    @timmaffett
    Owner

    OK, this is fixed in 4.2928.1

    The tree shaker can only see static strings and cannot resolve const variables. I was hoping to make the file size a little smaller, but there was no other reason to do it really. I now just use strings.

    Sorry about that one guys!

  4. timmaffett commented on Mar 31, 2026

    @timmaffett
    Owner

    ..and I would love a verification that it worked for you so I can close this!

  5. timmaffett commented on Apr 1, 2026

    @timmaffett
    Owner
  6. erf commented on Apr 1, 2026

    @erf

    I'm experiencing missing icons still in ^4.2928.1 . On iOS

  7. harsh774 commented on Apr 1, 2026

    @harsh774

    I am also facing the same issue. On Web, iOS and Android.

    Working for me if downgraded to 4.2906.0

  8. thomqr commented on Apr 1, 2026

    @thomqr

    same issue on web release.
    4.2906.0 and 4.2906.1 what supposed to be a fix patch

  9. Kr328 commented on Apr 2, 2026

    @Kr328

    I also discovered a strange behavior:
    In version 4.2928.0, when using a single icon alone, tree shaking works correctly. However, once a second specific icon is introduced, one of them becomes invisible.
    For example, with [Symbols.expand_content, Symbols.keep_off]: when only Symbols.expand_content is used, it works fine; but after adding Symbols.keep_off, Symbols.expand_content stops rendering.

  10. gianpaolodn commented on Apr 3, 2026

    @gianpaolodn

    Facing the same issue also with the version 4.2928.1, reverted to 4.2906.0

    My fault not checking the repo before spending hours trying to figure this out

  11. romarito commented on Apr 8, 2026

    @romarito

    The 4.2928.1 is normal in Android 7 but failed in Android 13, some icons are invisible there - in debug mode is ok, fail on release.

    Update: In web app is ok, too.

  12. danieeelfc commented on Apr 11, 2026

    @danieeelfc

    I’m seeing the same issue here.

    These two icons render correctly on both the emulator and a physical device:
    • Symbols.ad_off (0xf7b2)
    • Symbols.do_not_disturb_on (0xf08f)

    However, the following icons only render on the Android emulator and iOS simulator. They do not render on a physical Android device:
    • Symbols.chrome_reader_mode (0xe86d)
    • Symbols.pill (0xe11f)

  13. romarito commented on Apr 13, 2026

    @romarito

    I fixed this bug in 4.2928.1 by removing the use of the const String variable and going back to statiic strings for the fontFamiliy and fontPackage arguments.
    [edit] If that is not working I will have to investigate further when I get in the office.

    It's not working on release, only in debug.

  14. jlnrrg commented on Apr 20, 2026

    @jlnrrg

    Icons Disappearing Problem

    When using the version 4.2928.0 or 4.2928.1 some icons seem to be removed by the tree-shaking even though they are in use.
    This only occurs when building the application for real.
    In the below examples you can see the commands and if all icons were visible.

    flutter version
    Flutter 3.38.9 • channel stable • https://github.com/flutter/flutter.git
    Framework • revision 67323de285 (3 months ago) • 2026-01-28 13:43:12 -0800
    Engine • hash 5eb06b7ad5bb8cbc22c5230264c7a00ceac7674b (revision 587c18f873) (2 months ago) • 2026-01-27 23:23:03.000Z
    Tools • Dart 3.10.8 • DevTools 2.51.1

    Code

    I took the default flutter example app and added this package to the pubspec.yaml and modified the main.dart:

    Column(
      mainAxisAlignment: .center,
      children: [
        const Text('You have pushed the button this many times:'),
        Text('$_counter', style: Theme.of(context).textTheme.headlineMedium),
        Icon(Symbols.more_vert),
        Icon(Symbols.keyboard_arrow_up),
        Icon(Symbols.keyboard_arrow_down),
        Icon(Symbols.chevron_left),
        Icon(Symbols.chevron_right),
        Icon(Symbols.admin_panel_settings),
        Icon(Symbols.vpn_key),
        Icon(Symbols.lock),
        Icon(Symbols.pill),
        Icon(Symbols.chrome_reader_mode),
      ],
    ),

    Commands

    Version: 4.2928.0 & 4.2928.1

    cmd visible
    flutter run -d chrome --release ✅
    flutter build web
    python3 -m http.server 8080 --directory ./build/web
    ❌

    Version: 4.2906.0

    cmd visible
    flutter run -d chrome --release ✅
    flutter build web
    python3 -m http.server 8080 --directory ./build/web
    ✅

    Images

    Visible Icons
    Image

    Some Icons disappear
    Image

  15. timmaffett commented on Apr 23, 2026

    @timmaffett
    Owner

    I am at a loss to what is going on. The Flutter team made it so that we had to change how we define our IconData definitions (they made that class final, so I could no longer extend it) - but in the process they have somehow broken the tree shaking, which was the thing they purported to be fixing with their change.
    These reports are helpful - we should also be filing bug with the flutter project for having broken icon tree shaking.

  16. 3 remaining items

  17. mtallenca commented on May 15, 2026

    @mtallenca

    Using 4.2928.1, the icons don't render however the build log indicates the icons are also not tree shaken. They just don't appear.

  18. JetA2 commented on May 19, 2026

    @JetA2

    I used Xcode to install a "Profile" build (supposedly release mode) on a device. Icons work.
    Submitted the same version to the iOS App Store: disappearing icons.
    This is with Flutter 3.41.9 so it seems the Flutter PR did not address this.

  19. deminearchiver commented on May 19, 2026

    @deminearchiver

    Flutter 3.44 was released (or will be released in the coming days). Perhaps this issue might've been fixed? Was this problem occuring when using the master branch of Flutter?

  20. mjbader commented on May 19, 2026

    @mjbader

    In the Flutter 3.44.0 release notes:

    Mark all IconData fields as entrypoints to prevent tree shaking its fields by @mkustermann in 181849

    Looks like they fixed the tree shaking. I tested with our app and I no longer have any missing icons.

  21. jlnrrg commented on May 19, 2026

    @jlnrrg

    I also tried it with the latest Flutter 3.44.0 version and it seems to be fixed.
    Similar to my previous comment I used the following:

    Version: 4.2928.1

    cmd visible
    flutter run -d chrome --release ✅
    flutter build web python3 -m http.server 8080 --directory ./build/web ✅

    Please take note that this time the 2nd cmd also worked. 🎉

    Image
  22. JetA2 commented on May 20, 2026

    @JetA2

    My issue is that I can't reproduce the bug in my development environment. I'm using Flutter 3.41.9 to run flutter run --release and install to a real iOS device. The icons display correctly.

    The same code when submitted to the Apple App Store has disappearing icons.

    Is the tree-shaking happening differently when building for the App Store?

    In my case, the bug seems to affect only icons using the fill and weight properties.

  23. mkustermann commented on May 20, 2026

    @mkustermann
  24. dcharkes commented on May 20, 2026

    @dcharkes

    For web, this seems to be the same issue as

    I also tried it with the latest Flutter 3.44.0 version and it seems to be fixed.

    Interesting, I was not expecting it to be be fixed on web. flutter/flutter#181849 only targets the VM, not web.

    Build a release APK: flutter build apk --release

    Yes, flutter/flutter#181849, adds a fix for the VM. The PR adds an entry-point for the VM.

  25. jlnrrg commented on May 20, 2026

    @jlnrrg

    @JetA2 please refer to my above #46 (comment)
    flutter run --release worked all along. It was the issue with an actually build apllication.

  26. JetA2 commented on May 20, 2026

    @JetA2

    @jlnrrg ah, I see it now thanks!

    I managed to reproduce the bug with Flutter 3.41.9 on iOS using flutter build ipa --export-method ad-hoc.
    Doing the same with Flutter 3.44.0 the icons display correctly so it seems to be fixed indeed!

  27. reedom commented on May 22, 2026

    @reedom
    Author

    Confirmed fixed on my side too (Flutter 3.44.0).
    Thanks everyone for reporting and supporting.
    Closing.

  28. tulioccalazans commented on Jul 28, 2026

    @tulioccalazans

    The problem persists in version 4.2960.0

    Some icons are not rendering in release builds.

    This issue should be reopened.

  29. dcharkes commented on Aug 5, 2026

    @dcharkes

    I landed flutter/flutter#190225 on master yesterday. Could someone take a look if that fixes your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions