You can underline text in Flutter by using the decoration property of the TextStyle class. Here's an example:
Text(
'Underlined Text',
style: TextStyle(
decoration: TextDecoration.underline,
decorationColor: Colors.red, // optional
decorationThickness: 2, // optional
decorationStyle: TextDecorationStyle.dashed, // optional
),
);
In this example, the decoration property is set to TextDecoration.underline to underline the text. You can also specify the color of the underline using the decorationColor property, the thickness of the underline using the decorationThickness property, and the style of the underline using the decorationStyle property.
Note that the decoration property can also be used to add other text decorations, such as overline and line-through.
To know more about Flutter, join our Flutter Certification Course today.