I have already set on my pubspec.yaml the following code:
fonts:
- family: Roboto
fonts:
- asset: fonts/Roboto-Light.ttf
- asset: fonts/Roboto-Thin
Note: this is only if you prefer using fonts from fonts.google.com
One of the coolest and easiest way to use google fonts is to use the google_fonts_package.
The google_fonts package for Flutter allows you to easily use any of the 960 fonts (and their variants) from fonts.google.com in your Flutter app.With the google_fonts package, .ttf files do not need to be stored in your assets folder and mapped in the pubspec. Instead, they are fetched once via http at runtime, and cached in the app's file system.
google_fonts: ^0.1.0
import 'package:google_fonts/google_fonts.dart';
Text("TestText", style:GoogleFonts.dancingScriptTextStyle(
fontSize: 25,
fontStyle: FontStyle.normal,
)
Although it mentions that it should not be used in production but I see an app deployed on both playstore and appstore by Tim Sneath and works perfectly heres the open source code hope this helps