Cayden Atti
Cayden Atti

Reputation: 9

This Code wont run due to "Expected Identifier" and "Expected to find ":" " in flutter

child: Text(
            title,
              style: TextStyle(color : Colors.grey[700], decoration:  _enabledMap[title] == true ?  TextDecoration.lineThrough)
            ),

Hi there, I am new to coding and I need help, please can you show me where I'm going wrong

Upvotes: 0

Views: 31

Answers (1)

Md. Yeasin Sheikh
Md. Yeasin Sheikh

Reputation: 63864

You are providing data only for _enabledMap[title] == true. But you also need to provide when data is false for ternary case. You can provide null if you don't like to pass any TextDecoration

decoration: _enabledMap[title] == true
    ? TextDecoration.lineThrough
    : null

For more info, see the Dart docs on conditional expressions

Upvotes: 1

Related Questions