debugText function

void debugText(
  1. String label, [
  2. String detail = '',
  3. int skip = 15
])

Implementation

void debugText(String label, [String detail = '', int skip = 15]) {
  // 20240823 gjw Preprocess the label for special circumstances.

  label = label.replaceAll('Role.', '');

  // 20240823 gjw Always upercase the label.

  label = label.toUpperCase();

  // Calculate the number of spaces needed.

  int spacesCount = skip - label.length;

  // Ensure that spacesCount is not negative.

  if (spacesCount < 0) spacesCount = 0;

  // Create a string with the required number of spaces.

  String spaces = ' ' * spacesCount;

  // Combine the first text, spaces, and second text.

  debugPrint('$label$spaces$detail');
}