getUriFromEndpoints static method
it will create uri from given endpoint with including baseurl baseurl can be setup by calling setup function
Implementation
static Uri getUriFromEndpoints({
required String endpoint,
Map<String, dynamic>? queryParams,
List<String>? pathSeg,
}) {
if (_baseUri == null) {
throw Exception('PackageHttp.setup(baseUrl: ...) not called');
}
final base = _baseUri!;
final segments = <String>[
...base.pathSegments.where((e) => e.isNotEmpty),
...endpoint.split('/').where((e) => e.isNotEmpty),
if (pathSeg != null) ...pathSeg,
];
return Uri(
scheme: base.scheme,
host: base.host,
port: base.port,
pathSegments: segments,
queryParameters: queryParams,
);
}