validate static method
Validates a pattern topic; a mixed token such as a* is rejected.
Implementation
static void validate(Topic topic) {
for (var i = 0; i < topic.paths.length; i++) {
final token = topic.paths[i];
if (token == tail) {
if (i != topic.paths.length - 1) {
throw EventBusException(
'the ">" wildcard must be the last path token');
}
continue;
}
if (token == single) continue;
if (token.contains(single) || token.contains(tail)) {
throw EventBusException(
'a wildcard must be a whole path token: "$token"');
}
}
}