parse method

void parse(
  1. CertaboBoardType type,
  2. String message
)

Implementation

void parse(CertaboBoardType type, String message) {
  _length = message.length; // because ascii is used 1char == 1byte

  // Split and check if the length is right
  List<String> decodedItems = message.trim().split(" ").toList();

  if (decodedItems.isEmpty) {
    throw CertaboInvalidMessageLengthException(ascii.encode(message));
  }

  if (type == CertaboBoardType.Tabutronic) {
    parseTabutronic(decodedItems);
  } else if (type == CertaboBoardType.Certabo) {
    parseCertabo(decodedItems);
  } else {
    throw CertaboInvalidMessageLengthException(ascii.encode(message));
  }
}