build method

  1. @override
Uri build(
  1. OsrmRequest options
)
override

build method to build the server uri

Implementation

@override
Uri build(OsrmRequest options) {
  var profiles = ['foot', 'bike', 'car'];
  var urlToParse =
      '$baseUrl/${options.service.toString().split('.').last}/${options.version}/${profiles[options.profile.index]}/${options.stringCoordinates}';
  if (options.queryParameters.isNotEmpty) {
    urlToParse += '?';
    urlToParse += options.queryParameters.entries
        .map((e) => '${e.key}=${e.value}')
        .join('&');
  }
  return Uri.parse(urlToParse);
}