match static method
Implementation
static Object match(String method, Uri uri) {
var pathQuery = uri.path;
dynamic next;
///find matcher if has
if (_matcher != null) {
next = _matcher(uri);
if (next != null) return next;
}
routeFind(Map routes) {
if (routes.containsKey(pathQuery)) return routes[pathQuery];
for (String key in routes.keys) {
var regKey = key.startsWith('/') ? '^$key' : key;
if (RegExp(regKey).hasMatch(pathQuery)) return routes[key];
}
;
return null;
}
///find auto routes
dynamic routes = Map.from(routeMap[autoKey] ?? {});
next = routeFind(routes);
if (next != null) return next;
///find static
routes = Map.from(routeMap[method.toUpperCase()] ?? {});
next = routeFind(routes);
if (next != null) return next;
return Dartive.error('Not found pathQuery: "${pathQuery}" with method:$method');
}