Flutter Error: No named parameter with the name 'displayLarge'
Solution 1
Well, i don't know if you have tried this, but this problem is described here: issue219
In summary you have to use google_fonts v2.3 for Flutter v2.1 or grater.
Solution 2
google_fonts: ^2.3.1 has also solved the problems left in google_fonts: 2.3.0
Well! This issue will be raised in all projects using the google_fonts with a caret sign (^).
The caret sign (^) is used for pub dependencies in Dart to indicate a range of version numbers that are allowed. Specifically, any version from the specified version up to (but not including) the next non-breaking version is ok.
So google_fonts: ^2.2.0 is the same as '>=2.2.0 <3.0.0', It's shorthand for the longer form. The ^ is saying, I want to automatically use the most up-to-date package from Pub as long as that update won't break anything in my app. The google_fonts: 2.3.0 has some issues with this as of now.
Solution Steps :
- Remove (^) from your current google_fonts. max can be set as google_fonts: 2.2.0.
- To make sure, this does not conflict with any other dependency, for once do 'pub get'.
- Try to invalidate caches and restart. This should clean error, else do flutter clean to remove old updated google_fonts and pub get.
Done! You are good to go. Happy Codding!!!
Solution 3
Please follow the below steps to solve the issue.
- Open pubspec.yaml file.
- Change google_fonts: ^2.2.0 to google_fonts: 2.2.0
- Save.
Solution 4
set the package version to google_fonts: 2.2.0 and it should work properly
Karlo Kajba Šimanić
Updated on January 03, 2023Comments
-
Karlo Kajba Šimanić over 1 year
I am working on an app, I posted last update on git 2 days ago and haven't touched the code since. Now, I opened android studio and it was giving me this error when I tried to run it... I tried deleting repository from my computer and then cloning it again but it didn't work. I have also tried searching for similar problems, and found out there was a similar problem with speed-dial package and one comment said something about broken package versions. Anyways, this is the error I am getting after I try running my app:
These are first few lines of the error it's giving me, but there is more than a thousand lines following these.
I also tried running flutter doctor and it gave me the following:
-
mzimmermann about 2 yearsThanks for finding this solution, what a super-annoying bug; it appeared all of the sudden when running widget tests, such as
flutter test test/widget_test.dart
. This bug probably means a large number of flutter tests will fail afterflutter pub upgrade
. I confirm the linked suggestion fix the issue - in particular, I changed dependencies in pubspec.yaml fromgoogle_fonts: ^2.2.0
togoogle_fonts: 2.2.0
. -
Firus about 2 yearsGreat. If your problem has been resolved, please consider mark this questions as aswered.
-
mzimmermann about 2 yearsI upvoted your solution but I do not think I can accept, as I am not the original question author.
-
Aadn about 2 yearsRemoving the carrot fixed it! Thanks! I did try pub cache clean and flutter clean but didn't work. The carrot removal did.
-
ViKi Vyas about 2 yearsi'm glad i could help.
-
Mimu Saha Tishan about 2 yearsU made my day :)
-
manish kiranagi almost 2 yearswonderful. After clearing the pub cache, re-installing flutter and struggling for nearly 3 hours, this worked!