hasOnlyRepeatedCharacters static method

bool hasOnlyRepeatedCharacters(
  1. String input
)

Returns whether every character in the input is identical.

Implementation

static bool hasOnlyRepeatedCharacters(String input) {
  if (input.isEmpty) {
    return false;
  }
  final first = input.codeUnitAt(0);
  return input.codeUnits.every((unit) => unit == first);
}