expandSingle method
The single node reference expands to; throws otherwise.
Implementation
TreeReference expandSingle(TreeReference reference) {
final expanded = _evaluationContext.expandReference(reference)!;
if (expanded.length != 1) {
throw StateError(
'Provided xPath expands to ${expanded.length} references. Expecting '
'exactly one expanded reference.',
);
}
return expanded.single;
}