containsCharactersInOrder method

bool containsCharactersInOrder(
  1. List<int> characters
)

Implementation

bool containsCharactersInOrder(List<int> characters) {
  if (characters.isEmpty) {
    return true;
  }

  var characterIndex = 0;

  for (final currentCharacter in codeUnits) {
    if (currentCharacter == characters[characterIndex]) {
      characterIndex += 1;
      if (characterIndex == characters.length) {
        return true;
      }
    }
  }

  return false;
}