resourceHandlerByUri method
Look up a resource handler for an incoming resources/read URI.
Tries exact URI match first, then falls back to the path-derived key
(strips slashes, e.g. /routing → routing, `` → readme).
Implementation
ResourceHandler? resourceHandlerByUri(String uri) {
for (final entry in _resources.values) {
if (entry.resource.uri == uri) return entry.handler;
}
final key = (Uri.tryParse(uri)?.path ?? '').replaceAll('/', '');
return _resources[key]?.handler;
}