local_google_fonts 1.0.8

  • Readme
  • Changelog
  • Example
  • Installing
  • 81

local_google_fonts Pub Version #

Right now, adding google fonts to your flutter project can take a significant amount of time. This package looks to solve that by streamlining the whole process. All you need to do is add your fonts to your pubspec.yaml and run this package (more details below) to have them added to your assets folder and font configuration in your pubspec.yaml.

๐Ÿš€ Installing #

Simply add local_google_fonts: ^1.0.8 to your dev-dependencies

๐Ÿงพ Configuration #

Define what fonts you are requesting by adding the following to your pubspec.yaml:

    - Roboto
    - Open Sans

You can also define the weights if you don't want all available versions of a font. For the italicized version of a weight just add i to the end of the weight. Make sure that the weight you are requesting exists for that.

    - Roboto:
        - 400
    - Open Sans:
        - "400i"
        - 800

Defaults #

NameDefault ValueDescriptionTurn Off
formattrueFormats the pubspec.yaml file after writing to it because the write makes it look kinda weird. This does require the prettier cli. If its not currently installed and you have either npm or yarn on your machine it will be install it automatically.Add format: false under google_fonts in your pubspec.yaml
path"assets/fonts/googleFonts"Where the fonts should be downloaded too. Fonts not used by this program should not be in this folder.Add path: "" under google_fonts in your pubspec.yaml
flutterPubGettrueIf flutter pub get should be ran automatically once the fonts have been addedAdd flutterPubGet: false under google_fonts in your pubspec.yaml
docstrueAdds a README.md in the folder for each font with some information about the font.Add docs: false under google_fonts in your pubspec.yaml

๐Ÿƒ๐Ÿผโ€โ™‚๏ธ Running #

Simply run flutter pub run local_google_fonts:main

๐Ÿ™‹โ€โ™€๏ธ๐Ÿ™‹โ€โ™‚๏ธ Contributing #

All contributions are welcome! Just make sure that its not an already existing issue or pull request

1.0.8 #

  • Fix problem with VScode not recognizing project if flutter value in pubspec.yaml is wrapped in "".

1.0.7 #

  • Add README.md example

1.0.6 #

  • Add dartdoc to every method
  • Change homepage to github repo

1.0.5 #

  • Fix removal of directory if it doesn't exist
  • Add example Application
  • Fix example in README.md

1.0.4 #

  • Fix examples in documentation

1.0.3 #

  • Fix writing to ttf files

1.0.2 #

  • Improve documentation

1.0.1 #

  • Improve documentation

1.0.0 #

  • Download ttf files from css
  • Format yaml with prettier
  • Auto install prettier if npm or yarn is installed
  • Create documentation for each font
  • Write fonts to pubspec.yaml


Example #

Below is an example of a pubspec.yaml setup with local_google_fonts:

description: "A new Flutter project."
name: "example_app"
publish_to: "none"
version: "1.0.0+1"
  cupertino_icons: "^0.1.3"
    sdk: "flutter"
  local_google_fonts: "^1.0.4"
    sdk: "flutter"
  sdk: ">=2.7.0 <3.0.0"
    - family: "Roboto"
        - asset: "assets/fonts/googleFonts/Roboto/Roboto-400.ttf"
          weight: 400
    - family: "Open Sans"
        - asset: "assets/fonts/googleFonts/Open-Sans/Open-Sans-400i.ttf"
          style: "italic"
          weight: 400
        - asset: "assets/fonts/googleFonts/Open-Sans/Open-Sans-800.ttf"
          weight: 800
  uses-material-design: true
    - Roboto:
        - 400
    - Open Sans:
        - "400i"
        - 800

There is also an example application

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  local_google_fonts: ^1.0.8

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:local_google_fonts/files.dart';
import 'package:local_google_fonts/fonts.dart';
import 'package:local_google_fonts/pubspec.dart';
import 'package:local_google_fonts/status.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15

Analysis suggestions

Package not compatible with runtime flutter-web on Web


  • package:local_google_fonts/files.dart that imports:
  • package:local_google_fonts/status.dart that imports:
  • package:console/console.dart that imports:
  • dart:io

Package not compatible with runtime js


  • package:local_google_fonts/files.dart that imports:
  • package:local_google_fonts/status.dart that imports:
  • package:console/console.dart that imports:
  • dart:io


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
console ^3.1.0 3.1.0
http ^0.12.0+4 0.12.1
process_run ^0.10.8 0.10.10+2
yaml ^2.2.0 2.2.1
yamlicious ^0.1.0 0.1.0
Transitive dependencies
args 1.6.0
charcode 1.1.3
collection 1.14.13 1.15.0-nullsafety
http_parser 3.1.4
io 0.3.4
matcher 0.12.8
meta 1.2.2 1.3.0-nullsafety
path 1.7.0
pub_semver 1.4.4
quiver 2.1.3
source_span 1.7.0
stack_trace 1.9.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0 1.3.0-nullsafety
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
pedantic ^1.8.0 1.9.2
test ^1.6.0