dynamic_fonts
3.1.0, released 3 months ago by madlon-kay.com
Include dynamic web-hosted fonts or custom fonts in your Flutter app.
What it does
Allows you to load custom or web-hosted fonts dynamically at runtime via HTTP and cache them in the app's file system. It provides an API similar to google_fonts, supporting custom fonts hosted anywhere with checksum verification.
AI-written summary of version 3.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- Your app offers users multiple choices of fonts and you want to keep the initial download slim
- You want to use arbitrary fonts not found on Google Fonts via a dynamic loading mechanism
Skip it when
- You only use a fixed set of fonts that can be normally bundled in your app assets
- You want standard Google Fonts (use the official google_fonts package instead)
Strengths
- Reduces initial app bundle size by loading fonts on demand
- Supports automatic fallback to pre-bundled local assets if files match
- Allows security validation via SHA256 checksums and file lengths
Weaknesses
- Requires runtime HTTP fetching unless pre-bundled or pre-loaded
- Requires manual font registration and cryptographic verification setup
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
Register fonts using DynamicFonts.register and optionally bundle fallback files in your pubspec assets.
Text(
'This is Dynamic Fonts',
style: DynamicFonts.getFont('FiraGO'),
);Alternatives
Packages that do the same job and could replace dynamic_fonts.
- google_fonts
Pick google_fonts if you specifically want to load Google Fonts instead of arbitrary custom-hosted fonts.
95Compare
Works with
Packages commonly used together with dynamic_fonts: ones it builds on, ones built on it, and its own family.