tryFromCode static method

XPathErrorCode? tryFromCode(
  1. String code
)

Looks up a known XPathErrorCode by its code name or qualified name, or returns null.

Implementation

static XPathErrorCode? tryFromCode(String code) {
  final clean = code.contains(':') ? code.split(':').last : code;
  for (final val in values) {
    if (val.name == clean) return val;
  }
  return null;
}