uri method
Implementation
Uri uri(
String apiEndPoint, {
Map<String, String> queryParameters,
String basePath,
String protocol,
String host,
int port,
}) {
if (apiEndPoint == null) {
throw Exception('UriMuProto: api Endpoint cannot be null or empty');
}
if (basePath != null) {
this.basePath = basePath;
}
if (host != null) {
this.host = host;
}
if (this.host == null) {
this.host = window.location.host.contains(':') ? defaultHost : window.location.host;
}
if (setHostFromBrowser) {
this.host = window.location.host;
}
if (port != null) {
this.port = port;
}
this.basePath ??= '';
apiEndPoint = '${this.basePath}$apiEndPoint';
var proLen = window.location.protocol.length;
var scheme = '';
if (protocol != null) {
scheme = protocol;
} else if (this.protocol == ProtocolType.notDefine || this.protocol == null) {
scheme = window.location.protocol.substring(0, proLen - 1);
if (window.location.protocol.contains('memory')) {
scheme = 'http';
}
} else if (this.protocol == ProtocolType.https) {
scheme = 'https';
} else if (this.protocol == ProtocolType.http) {
scheme = 'http';
}
//queryParameters ??= {};
return Uri(
scheme: scheme,
userInfo: '',
host: this.host,
port: this.port,
pathSegments: apiEndPoint.split('/'),
queryParameters: queryParameters);
}