uri property

Uri get uri

Generate the requesting Uri from the options.

Implementation

Uri get uri {
  String url = path;
  if (!url.startsWith(RegExp(r'https?:'))) {
    url = baseUrl + url;
    final s = url.split(':/');
    if (s.length == 2) {
      url = '${s[0]}:/${s[1].replaceAll('//', '/')}';
    }
  }
  final query = Transformer.urlEncodeQueryMap(queryParameters, listFormat);
  if (query.isNotEmpty) {
    url += (url.contains('?') ? '&' : '?') + query;
  }
  // Normalize the url.
  return Uri.parse(url).normalizePath();
}