Icon Font Generator

Setup

Installing

dart pub global activate icomoon_icons_generator

Run Package

Note :

  • The CSS file will be obtained by downloading the icon font from the website http://icomoon.io.
dart pub global run icomoon_icons_generator <input CSS file> <output Dart file> <output Mapper Dart file> <Font Family> <Class Name>

Example CLI

dart pub global run icomoon_icons_generator input.css output.dart mapper.dart "moonIcon" "MoonIcons"

Updated Flutter project's pubspec.yaml:

flutter:
  fonts:
    - family: moonIcon
      fonts:
        - asset: fonts/icomoon.ttf

Example

import 'package:flutter/material.dart';

class MoonIcons {
  static const String _fontFamily = 'moonIcon';

  static const add = IconData(0xe901, fontFamily: _fontFamily);
}

Map<String, IconData> getIcons() {
  return {
    "add": MoonIcons.add,
  };
}