Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can't change text decoration color anymore in flutter

I have the following text widget

Text(
  todo.todoText!,
  style: TextStyle(
    fontSize: 16,
    color: (isDark) ? Colors.white : Colors.black87,
    decoration: todo.isDone ? TextDecoration.lineThrough : null),
    decorationColor: (isDark) ? Colors.white : Colors.black87  // error
)

This is the error I get:

The named parameter ‘decorationColor’ isn’t defined. Try correcting the name to an existing named parameter’s name, or defining a named parameter with the name ‘decorationColor’

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

As far as the official docs goes
docs
There is indeed a named parameter called decorationColor.
I’m using Flutter 3.16.9

Flutter 3.16.9 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 41456452f2 (4 months ago) • 2024-01-25 10:06:23 -0800
Engine • revision f40e976bed
Tools • Dart 3.2.6 • DevTools 2.28.5

Please help me out 🙂

>Solution :

Yes, it’s a syntax error:

You have closed the Parantheses-bracket of TextStyle object while giving more parameters like decorationColor.

decoration: todo.isDone ? TextDecoration.lineThrough : null),

To

decoration: todo.isDone ? TextDecoration.lineThrough : null,
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading