fatal error: google fonts in flutter throws error

2,076

Solution 1

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 .

Solution 2

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

Share:
2,076
Janak Vaghasiya
Author by

Janak Vaghasiya

Updated on January 03, 2023

Comments

  • Janak Vaghasiya
    Janak Vaghasiya over 1 year

    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

    • Yeasin Sheikh
      Yeasin Sheikh about 2 years
      Can you try with flutter clean and rebuilding the app.
    • Janak Vaghasiya
      Janak Vaghasiya about 2 years
      i have already tried that , but it seems like issue is with library & flutter version
  • Janak Vaghasiya
    Janak Vaghasiya about 2 years
    yes i have updated version & it works