printUnderlinedText static method

Future<bool> printUnderlinedText(
  1. String text, {
  2. String underlineChar = '-',
  3. bool addNewLine = true,
})

Print text with an underline.

Creates underlined text for emphasis.

  • text: The text to underline
  • underlineChar: Character to use for the underline
  • addNewLine: Whether to add a newline after the underlined text

Returns true if printing was successful.

Implementation

static Future<bool> printUnderlinedText(
  String text, {
  String underlineChar = '-',
  bool addNewLine = true,
}) async {
  final underline = underlineChar * text.length;
  final combinedText = '$text\n$underline${addNewLine ? '\n' : ''}';
  return await printText(combinedText);
}