parse static method

ETEntityReference? parse(
  1. String ref
)

Implementation

static ETEntityReference? parse(String ref) {
  if (ref.length < 3) return null;

  ref = ref.trim();

  var idx = ref.indexOf('#');
  if (idx < 1) return null;

  var typePart = ref.substring(0, idx);
  var idPart = ref.substring(idx + 1);

  if (!matchesType(typePart, 0, typePart.length)) return null;
  if (!matchesID(idPart, 0, idPart.length)) return null;

  var id = parseInt(idPart)!;

  return ETEntityReference(typePart, id);
}