matchesFull function
Returns true if pattern
has a single match in str
that matches the
whole string, not a substring.
Implementation
bool matchesFull(Pattern pattern, String str) {
var match = pattern.matchAsPrefix(str);
return match != null && match.end == str.length;
}