Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal error: google fonts in flutter throws error

i'm getting this error in flutter

../../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/google_fonts-2.3.0/lib/google_fonts.dart:142265:7: Error: No named parameter with the name 'displayLarge'.
      displayLarge:
      ^^^^^^^^^^^^
../../../snap/flutter/common/flutter/packages/flutter/lib/src/material/text_theme.dart:81:9: Context: Found this candidate, but the arguments don't match.
  const TextTheme({
        ^^^^^^^^^

while running mobile application

some code snippets...

pubspec.yaml

dependencies:
  flutter:
    sdk: flutter
  http: ^0.13.4
  cupertino_icons: ^1.0.2
  google_fonts:
  get:

code

     Padding(
              padding: const EdgeInsets.all(8.0),
              child: Text(
                'Details',
                style: GoogleFonts.pacifico(),
              ),
            )

thank you in advance

like image 864
Janak Vaghasiya Avatar asked Jun 18 '26 10:06

Janak Vaghasiya


2 Answers

You should try setting a specific version as it seems to be caused by a requirement by the recent google_fonts update.

Using google_fonts:2.1.1 worked for me.

Also check https://github.com/material-foundation/google-fonts-flutter/issues/219 .

like image 111
Onuoha Obinna Avatar answered Jun 24 '26 15:06

Onuoha Obinna


i have updated flutter version to 2.10.0 & now it is working

like image 42
Janak Vaghasiya Avatar answered Jun 24 '26 16:06

Janak Vaghasiya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!