Skip to content

[google_fonts] Decouple GoogleFontsLite for full tree-shaking and add full feature parity - #12830

Open
Piinks wants to merge 5 commits into
flutter:mainfrom
Piinks:google-fonts-lite-enhancements
Open

[google_fonts] Decouple GoogleFontsLite for full tree-shaking and add full feature parity#12830
Piinks wants to merge 5 commits into
flutter:mainfrom
Piinks:google-fonts-lite-enhancements

Conversation

@Piinks

@Piinks Piinks commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

In PR #11433 #11433, google_fonts_lite.dart was introduced as an alternative entry point containing only dynamic font resolution methods and the family descriptor map, allowing compilers to tree-shake the static generated font methods.

#11433 was a huge PR, and a breaking one, so we did not publish it yet. Currently this package is set to publish_to: none.

For these reasons I decided to follow up on a few more bits of polish here instead of belaboring the mega PR and the contributor's effort.

After this change, I will migrate this package to material_ui and then we will publish one major release with all of these changes to reduce churn on the ecosystem.

This PR ensures google_fonts_lite.dart is fully decoupled from the main entry point by sharing an internal configuration singleton, ensuring complete compiler tree-shaking of unused generated font code, while adding missing features to google fonts lite for full feature parity with the non-lite version.

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Sep 10, 2026
@github-actions github-actions Bot added p: google_fonts triage-design Should be looked at in design triage labels Sep 10, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request decouples the internal base library from the main entry point to ensure complete tree-shakability, and adds config, pendingFonts, and getTextTheme to GoogleFontsLite along with documentation and tests. The review feedback suggests throwing an ArgumentError instead of a generic Exception when a font family is not found in getTextTheme, and updating the corresponding test to match.

Comment thread packages/google_fonts/generator/google_fonts_lite.tmpl
Comment thread packages/google_fonts/test/google_fonts_lite_test.dart
@Piinks
Piinks force-pushed the google-fonts-lite-enhancements branch from 4aa7b60 to 3a212e3 Compare September 10, 2026 22:38
@Piinks
Piinks requested a review from elliette September 10, 2026 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD p: google_fonts triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant