google_fonts
9.0.0, released 8 weeks ago by flutter.dev
Flutter package to load Google Fonts at runtime or bundle them as assets
What it does
Provides a simple API to use Google Fonts in Flutter apps. It supports HTTP fetching, caching, and asset bundling, with a lightweight tree‑shakable Lite variant.
AI-written summary of version 9.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- Need to use Google Fonts without adding large font files to the app
- Want runtime font fetching during development
- Want to bundle only the fonts you use to keep the app size small
Skip it when
- You need a very small bundle and cannot afford the runtime fetch overhead
- You prefer to manage fonts manually without the convenience API
Strengths
- Easy to use API with static and dynamic font methods
- Built‑in caching and asset prioritization
- Tree‑shakable Lite variant reduces bundle size
Weaknesses
- Adds a dependency and potential runtime fetch delay
- Large asset bundle if many fonts are bundled
- Requires manual asset setup for offline use
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 5
Add `google_fonts` to pubspec dependencies. For offline bundling, download desired font files, place them in an assets folder, and list the folder under `assets:` in pubspec.yaml. No special permissions needed.
Text('Hello', style: GoogleFonts.lato()),Alternatives
Packages that do the same job and could replace google_fonts.
- flutter_boxicons
Flutter package providing Boxicons icon set with over 2K icons.
57Compare - community_material_icon
A community material design icon set for Flutter applications.
50Compare - system_fonts
Load system fonts (ttf/otf) on Windows, macOS, Linux for Flutter apps
44Compare - flutter_tabler_icons
Tabler Icon Pack for Flutter using icons from the Tabler Icons repository.
50Compare
Works with
Packages commonly used together with google_fonts: ones it builds on, ones built on it, and its own family.
- cryptogoogle_fonts depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- path_providergoogle_fonts depends on itProvides Flutter APIs to locate common filesystem directories on Android, iOS, macOS, Linux and Windows.
- material_uigoogle_fonts depends on itOfficial Flutter Material UI library implementing Google’s Material Design system.
- go_routerSame familyDeclarative routing package for Flutter based on Navigation 2 supporting deep links and URL-based navigation.
- google_sign_in_iosSame familyiOS and macOS implementation of Google Sign-In for Flutter
- google_sign_in_androidSame familyAndroid implementation of the google_sign_in plugin
- google_sign_inSame familyOfficial Flutter plugin for authenticating users and requesting OAuth scopes via Google Sign-In.
- animationsSame familyFancy pre-built animations that can easily be integrated into any Flutter application.