isValidMorse function

bool isValidMorse(
  1. String morse
)

Validates whether the given Morse code sequence is valid.

Implementation

bool isValidMorse(String morse) {
  return morse
      .split(' ')
      .every((code) => _reverseMorseCodeMap.containsKey(code));
}