icon_font_generator
4.1.0, released 10 months ago by serge.software
Converts SVG icons to OpenType fonts and generates Flutter-compatible icon classes.
What it does
Processes a directory of SVG files, converts them into a single OTF font file, and generates a Dart class with identifiers for easy use in Flutter apps (similar to Material Icons). It provides both a CLI tool and a Dart API.
AI-written summary of version 4.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You have a custom set of SVG icons that you want to bundle into a single icon font.
- You want code-generated static constants for your custom icon font to ensure type safety and autocomplete.
Skip it when
- You prefer rendering vector SVGs directly at runtime without converting them to a font.
- Your project requires complex multi-color vector assets that cannot be represented in a single-color font format.
Strengths
- Works fully in Dart without external platform dependencies.
- Provides both a CLI tool and programmatic API functions.
- Supports YAML configuration via pubspec.yaml or icon_font.yaml.
Weaknesses
- Generated font uses PostScript Table version 3.0 which doesn't contain glyph names.
- Limited support for certain complex SVG attributes and features.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 11
Add as a dev dependency and run via CLI or add to pubspec.yaml.
import 'package:icon_font_generator/icon_font_generator.dart';
void main() async {
await svgToOtf(inputDir: 'assets/svg/', outputFontFile: 'fonts/my_icons_font.otf');
}Alternatives
Packages that do the same job and could replace icon_font_generator.
- data_class_plugin
A tool that uses Dart's Analyzer to generate data classes, unions, and enums.
71Compare - supadart
CLI tool that generates type-safe Dart and Flutter classes from your Supabase database schema.
63Compare - license_generator
A Dart tool to generate a license file containing all third-party library licenses.
55Compare - hive_generator
Generates Hive TypeAdapter code for Dart classes automatically.
50Compare
Works with
Packages commonly used together with icon_font_generator: ones it builds on, ones built on it, and its own family.
- yamlicon_font_generator depends on itA Dart library for parsing YAML documents into Dart data structures.
- xmlicon_font_generator depends on itFull-featured XML and XPath library for DOM parsing, SAX streaming, and fluent building.
- dart_styleicon_font_generator depends on itProvides an API and CLI to format Dart source code automatically.
- argsicon_font_generator depends on itLibrary for parsing raw command-line arguments into options and values using GNU and POSIX styles.
- vector_mathicon_font_generator depends on itVector math library for 2D/3D/4D vectors, matrices, quaternions, and geometry.
- path_parsingicon_font_generator depends on itPure Dart library for parsing SVG path strings and generating Dart path code.
- loggericon_font_generator depends on itAn extensible logger for printing formatted logs with levels, custom filters, and printers.
- recaseicon_font_generator depends on itChanges the case of input text to various conventions.