Janak Vaghasiya
Janak Vaghasiya

Reputation: 167

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

Upvotes: 8

Views: 10095

Answers (2)

Janak Vaghasiya
Janak Vaghasiya

Reputation: 167

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

Upvotes: 1

Onuoha Obinna
Onuoha Obinna

Reputation: 172

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 .

Upvotes: 11

Related Questions