Neura MarketNeura Market/CoPilot
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityCoPilotCoPilot
    DeepSeekDeepSeekStable DiffusionStable DiffusionMidjourneyMidjourney
    View All Directories
    OverviewRulesPromptsMCPsAgentsBlogVideosGuidesCoursesCommunityPluginsTrendingGenerate
    CoPilotBlogStop hand-writing IconData — introducing `icon_font_extractor`
    Back to Blog
    Stop hand-writing IconData — introducing `icon_font_extractor`
    flutter

    Stop hand-writing IconData — introducing `icon_font_extractor`

    Julian Finkler May 14, 2026
    0 views

    If you've ever dropped a custom icon font into a Flutter app and then spent the next hour copying...

    If you've ever dropped a custom icon font into a Flutter app and then spent the next hour copying codepoints from a website into static const declarations, this one's for you. (https://pub.dev/packages/icon_font_extractor) --- The real pain: Font Awesome Pro My specific trigger for building this package was Font Awesome Pro. FA Pro is excellent — thousands of high-quality icons, multiple styles (solid, regular, light, thin, duotone), and a proper ligature-based font file. But integrating it into Flutter the "normal" way is a nightmare: Find the codepoint for each icon you need Write static const IconData faHouse = IconData(0xf015, fontFamily: 'FontAwesomePro') by hand Repeat for every single icon across every style variant Maintain it when you update the font There are third-party packages that ship pre-built constant maps, but those only cover the free tier, go stale between FA versions, and add a dependency you have to trust. If you're paying for Pro, you have the font file — you should be able to use it directly, with zero manual work. --- How icon_font_extractor works Icon fonts like Font Awesome Pro, Material Symbols, IcoMoon exports, and Fontello bundles all ship a GSUB ligature table inside the font file. That table maps human-readable strings ("house", "arrow-left", "trash-can") to glyph IDs, which are in turn mapped to codepoints via the font's cmap table. icon_font_extractor reads those two tables in pure Dart — no native code, no external font tooling — and emits a .g.dart file with a typed IconData constant for every ligature it finds. --- Setup is few lines of YAML You don't even add it as a dependency in your app. Install it globally once: dart pub global activate icon_font_extractor Then add a single block to your existing pubspec.yaml: ```yaml flutter: fonts: - family: FontAwesomePro # already here if you're using the font fonts: - asset: assets/fonts/fa-pro-6-solid-900.otf icon_fonts: - family: FontAwesomePro outputFile: lib/icons/fa_pro_solid.g.dart naming: snake # icn_house, icn_arrow_left, icn_trash_can iconPrefix: fa # fa_house, fa_arrow_left, … ``` Run the generator: icon_font_extractor generate And you're done. You get a file like this: ```dart // GENERATED CODE - DO NOT MODIFY BY HAND. import 'package:flutter/widgets.dart'; @staticIconProvider abstract final class FontAwesomePro { FontAwesomePro._(); /// Ligature: `house` static const IconData fa_house = IconData(0xE001, fontFamily: 'FontAwesomePro'); /// Ligature: `arrow-left` static const IconData fa_arrow_left = IconData(0xE002, fontFamily: 'FontAwesomePro'); // … hundreds more } ``` Use it exactly like any built-in icon: - `Icon(FontAwesomePro.fa_house, size: 24)` - `IconButton(icon: Icon(FontAwesomePro.fa_arrow_left), onPressed: _goBack)` --- The best part: tree-shaking just works Flutter's icon tree-shaking is baked into flutter build — it scans your compiled Dart code for IconData literals and strips every glyph from the font that isn't referenced. This normally only works with the Material icon set because it requires @staticIconProvider-annotated classes. icon_font_extractor emits exactly that annotation on every generated class. So if your app uses 40 out of 2,000 Font Awesome icons, only those 40 glyphs end up in your release build. No manual subsetting, no IcoMoon round-trips, no --tree-shake-icons=false workarounds. --- Multiple fonts, multiple styles Font Awesome Pro ships separate files per style. No problem — list them all: ```yaml icon_fonts: - family: FontAwesomeProSolid outputFile: lib/icons/fa_solid.g.dart iconPrefix: fas - family: FontAwesomeProRegular outputFile: lib/icons/fa_regular.g.dart iconPrefix: far - family: FontAwesomeProLight outputFile: lib/icons/fa_light.g.dart iconPrefix: fal ``` Each gets its own generated file. One generate run covers all of them. --- Naming flexibility Every team has different conventions. Four built-in strategies cover the common ones: | Strategy | Example output | |---|---| | snake (default) | faarrowback_ios | | camel | faArrowBackIos | | pascal | FaArrowBackIos | | keep | faArrow-back-ios (as-is after sanitising) | The prefix is also configurable (iconPrefix), and it participates in the chosen strategy — so snake with prefix fa produces fa_house, camel produces faHouse, and pascal produces FaHouse. Consistent all the way down. --- CI-friendly A --check flag makes the tool exit non-zero if any generated file would change without actually writing it. Drop it in your CI pipeline to catch stale generated code before it lands: ```yaml # GitHub Actions / any CI - run: dart pub global activate icon_font_extractor - run: icon_font_extractor generate --check ``` --- Works for any icon font Font Awesome is just the motivating example. The same workflow applies to: - Material Symbols (the newer variable-weight successor to Material Icons) - IcoMoon / Fontello custom bundles - Any font exported from Figma with ligature names Internal design-system fonts your team owns If the font has a GSUB ligature table, iconfontextractor can read it. --- Get started dart pub global activate icon_font_extractor Feedback, issues, and PRs are welcome. If you're using Font Awesome Pro or another commercial font and hit an edge case, open an issue — the more real-world fonts this is tested against, the better. Happy coding! 🎉

    Tags

    fluttertoolingdartpresentation

    Comments

    More Blog

    View all
    Minimalist EKS: The Easy Waykubernetes

    Minimalist EKS: The Easy Way

    Amazon EKS manages the Kubernetes control plane, but you remain responsible for provisioning the...

    J
    Joaquin Menchaca
    Never forget to enter the Stern Grove lottery again!ai

    Never forget to enter the Stern Grove lottery again!

    Browser automation with Playwright, Python, GitHub Actions, and Entire to auto-enter San Francisco Stern Grove concert lotteries each week!

    L
    Lizzie Siegle
    A Free Screenshot Editor That Never Uploads Your Imagetypescript

    A Free Screenshot Editor That Never Uploads Your Image

    A free screenshot and image editor that runs entirely in your browser. Keeping every edit reversible and handling big phone photos, in plain TypeScript and Canvas2D.

    M
    Martin Stark
    I built a CLI to break my highlights out of Apple Booksshowdev

    I built a CLI to break my highlights out of Apple Books

    A macOS CLI + MCP server that exports Apple Books highlights to Markdown and gives AI assistants direct access to your reading notes.

    A
    Andrey Korchak
    A Developer's Guide to Agent Hooks in Antigravity CLIai

    A Developer's Guide to Agent Hooks in Antigravity CLI

    Motivation To be quite honest, "Hooks"—the shell commands we trigger at specific points...

    T
    Tanaike
    Tactical vs. Strategic Agentic AI Development — A Playbook for Developersagents

    Tactical vs. Strategic Agentic AI Development — A Playbook for Developers

    The Strategic Engineer: Why Writing Code Is No Longer Your Most Valuable Skill ...

    A
    Adewumi Saheed Adewale

    Stay up to date

    Get the latest CoPilot prompts, rules, and resources delivered to your inbox weekly.

    Neura Market LogoNeura Market

    Discover the best AI prompts, plugins, and resources for CoPilot and more.

    Content Types

    • Rules
    • Prompts
    • MCPs
    • Agents
    • Guides

    Platforms

    • ChatGPT Directory
    • Claude Directory
    • Gemini Directory
    • Cursor Directory
    • Grok Directory
    • Perplexity Directory
    • DeepSeek Directory
    • CoPilot Directory
    • Stable Diffusion Directory
    • Midjourney Directory
    • All Directories

    Resources

    • Blog
    • Documentation
    • Help Center
    • Marketplace

    Legal

    • Privacy Policy
    • Terms of Service

    © 2026 Neura Market. All rights reserved.

    |

    Not affiliated with any AI platform vendors.

    Stop hand-writing IconData — introducing `icon_font_extractor` — CoPilot Blog