spacedText function

String spacedText(
  1. String text,
  2. int n
)

Shared helper: inserts n hair spaces between characters. Pure Dart. No Flutter.

Implementation

String spacedText(String text, int n) {
  if (n <= 0 || text.isEmpty) return text;
  const hair = '\u200A';
  final spacer = List.filled(n, hair).join();
  return text.split('').join(spacer);
}