Flutter/ How to get Google Fonts Family List

Viewed 1342

Hello I am developing app with Flutter.

To manage the fonts in my App, I am using

https://pub.dev/packages/google_fonts

Package.

So I plan to user can choice font that they want.

Is there any way I can get the entire list of google font family ?

List<String> _tempFontList = [
  GoogleFonts.droidSerif().fontFamily,
  GoogleFonts.ebGaramond().fontFamily,
  GoogleFonts.fasterOne().fontFamily,
  GoogleFonts.abel().fontFamily,
];

For now I made just temp List for the fonts,

But as I see there is no list getList functions in that package.

Thanks for reading.

I will Waite for your help.

2 Answers

In order to get the list of fonts.

GoogleFonts.asMap();

that will return the Map object.

if you just want the names.

GoogleFonts.asMap().keys.toList();

There's no getter to get the list of fonts supported by this package, but you can see the list from(package) here

Related