Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Flutter build fails with: No named parameter with the name 'displayLarge'

ErrorError: No named parameter with the name 'displayLarge'.

Short answer

The package was written for a newer Flutter than the one installed. Since the 2021 Material text style names (displayLarge, headlineMedium, bodySmall and so on) are used inside the package, an older SDK has no such TextTheme parameter. Upgrade Flutter to the version the package asks for, or pin the package to an older release.

  • Applies to Flutter 3.x stable, Dart 3, google_fonts from pub.dev
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print the Flutter version you actually build with, and compare it with the minimum that the package release lists in its changelog.

    flutter --version
    flutter pub deps | grep google_fonts
  2. 2Match what you see, then jump to its fix

    1. 1The error points inside a hosted package under .pub-cache, not into your own lib/ folderThe Flutter SDK is older than the package release needsFix
    2. 2The project is locked to an older Flutter version (a team or CI constraint) and the package was just upgradedYou cannot upgrade Flutter yet, so the package has to go backFix

What does the error look like?

  • Error: No named parameter with the name 'displayLarge'.

Cause 1 of 2

The Flutter SDK is older than the package release needs

1Check

Each google_fonts release states its minimum Flutter version in the changelog on pub.dev (for example 6.2.1 needs Flutter 3.19.2). Read the changelog entry for the version in your pubspec.lock and compare it with the output of flutter --version.

flutter --version
grep -A3 "google_fonts:" pubspec.lock

2Fix

Upgrade the SDK on your current channel. Then fetch packages again.

flutter upgrade
flutter pub get

3Verify

The analyzer no longer reports the missing parameter and the app builds.

flutter analyze
flutter run

Confirmed by pub.dev

Did this fix it?

Cause 2 of 2

You cannot upgrade Flutter yet, so the package has to go back

1Check

The changelog shows that release 2.3.0 switched the package to the 2021 text style names, and that each later release raises the Flutter minimum. A release before 2.3.0 does not use the new names.

grep -n "google_fonts" pubspec.yaml

2Fix

Constrain the package to a release that your Flutter version can compile, then resolve again.

# pubspec.yaml
dependencies:
  google_fonts: ">=1.1.0 <2.3.0"

3Verify

Dependency resolution succeeds and the build gets past the kernel snapshot step.

flutter pub get
flutter build apk --debug

Confirmed by pub.dev

Did this fix it?

How do I stop it coming back?

  • Read the changelog entry for the Flutter minimum before you bump a package across several releases.
  • Pin the Flutter version for the team and for CI, so every machine compiles the same SDK.
  • Commit pubspec.lock for apps so a fresh checkout resolves the same package versions.
  • Use the 2021 text style names (displayLarge, bodyMedium) in your own TextTheme code.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.