class OdooApiUriBuilder { OdooApiUriBuilder._(); static Uri endpoint(Uri serverUri, String endpointPath) { final basePath = serverUri.path.replaceFirst(RegExp(r'/+$'), ''); final normalizedEndpoint = endpointPath.startsWith('/') ? endpointPath : '/$endpointPath'; return Uri( scheme: serverUri.scheme, host: serverUri.host, port: serverUri.hasPort ? serverUri.port : null, path: '$basePath$normalizedEndpoint', ); } }