While working on my Flutter project, I faced an issue where the CardTheme
was showing errors in Android Studio. In this post, I’ll explain why this
happens and how to fix it step by step.
I was trying to customize the Card Theme in my Flutter app, but every line
inside Card Theme was showing an error.
Error Code
CardTheme(
elevation: 2,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
)
The issue happened because CardTheme parameters changed in the latest
Flutter version. Wrapping it correctly and using the updated API fixes
the problem.
cardTheme: const CardTheme(
elevation: 2,
)
After applying this fix, all errors were removed and the app worked perfectly.
If you are facing similar issues in Flutter, I hope this post helps you.
Feel free to comment if you have questions.
Top comments (0)