textWithCursor method

String textWithCursor({
  1. String cursorChar = '▌',
  2. bool showCursor = true,
})

Returns the text with a cursor indicator at the current position.

cursorChar is the character to show at cursor (e.g., '▌', '|', '_'). showCursor can be toggled for blinking effect.

Implementation

String textWithCursor({
  String cursorChar = '▌',
  bool showCursor = true,
}) {
  if (!showCursor) return text;

  final before = textBeforeCursor;
  final after = textAfterCursor;
  return '$before$cursorChar$after';
}