Flutter/ How to get Google Fonts Family List

762

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();

Share:
762
DaegilPyo
Author by

DaegilPyo

Updated on December 29, 2022

Comments

  • DaegilPyo
    DaegilPyo over 1 year

    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.