registerRoute static method
Helper method to register routes manually when reflection is not available.
Implementation
static void registerRoute(
Router router,
String method,
String path,
Handler handler,
) {
final normalizedPath = path.isEmpty ? '/' : path;
switch (method.toUpperCase()) {
case 'GET':
router.get(normalizedPath, handler);
break;
case 'POST':
router.post(normalizedPath, handler);
break;
case 'PUT':
router.put(normalizedPath, handler);
break;
case 'DELETE':
router.delete(normalizedPath, handler);
break;
case 'PATCH':
router.patch(normalizedPath, handler);
break;
default:
throw ArgumentError('Unsupported HTTP method: $method');
}
}