parse static method

List parse(
  1. String message
)

Implementation

static List parse(String message) {
  final lowercase = message.toLowerCase();
  final prefix = lowercase.substring(0, 3);

  if (prefix != 'ur:') {
    throw InvalidSchemeError();
  }

  final components = lowercase.substring(3).split('/');
  final type = components[0];

  if (components.length < 2) {
    throw InvalidPathLengthError();
  }

  if (!isURType(type)) {
    throw InvalidTypeError();
  }

  return [type, components.sublist(1)];
}