The Google Fonts Package in Flutter app is not working
7,456
Solution 1
Please check internet connection- your emulator does not have internet connectivity. google fonts need internet connection on device/emulator.
Solution 2
After adding the dependency pubspec.yaml file
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
google_fonts: ^0.2.0
run the command in terminal\cmd console as :
> flutter packages get
this will fetch the dependency into your workspace.
Author by
Tofiq Samali
I am learning Flutter to develop Android & iOS & web app. in past I was not Developer and have done some small civil projects. I love self-study and to be aware of new technologies.
Updated on December 16, 2022Comments
-
Tofiq Samali 11 months
First, I added the google_fonts package to your pubspec dependencies.
dependencies: flutter: sdk: flutter cupertino_icons: ^0.1.2 google_fonts: ^0.2.0
Then
import 'package:google_fonts/google_fonts.dart';
and apply to a Text widget
Text( 'This is Google Fonts', style: GoogleFonts.lato(fontSize: 40), ), Text( 'This is Google Fonts', style: GoogleFonts.adventPro(fontSize: 40), ),