parse static method

List<String> parse(
  1. String input
)

Implementation

static List<String> parse(String input) {
  if (input.isEmpty) {
    throw Exception('Message is incomplete.');
  }

  if (input[input.length - 1] != TextMessageFormat.recordSeparator) {
    throw Exception('Message is incomplete.');
  }

  var messages = input.split(TextMessageFormat.recordSeparator)..removeLast();
  return messages;
}