解码时出错 Uri.https、"Unhandled Exception: FormatException: Invalid character (at character 27)"

Error when decoding Uri.https, "Unhandled Exception: FormatException: Invalid character (at character 27)"

我正在尝试构建天气应用程序。我搜索了天气 API's,因为我需要每小时和每周的天气预报。我找到了这个网站 https://www.visualcrossing.com/。我想像这样解码 HTTP link(下面的代码):

class DataServiceOneCall {
  Future<WeatherResponseOnecall> getWeatherOneCall(String city) async {
    //https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/Olszowice?unitGroup=metric&key=QVDLJFCCQRM5296M7J975FP2W&contentType=json

    final queryParameters = {
      'q': city,
      'unitGroup': 'metric',
      'key': 'QVDLJFCCQRM5296M7J975FP2W',
      'contentType': 'json',
    };

    final uri = Uri.https(
        'weather.visualcrossing.com/VisualCrossingWebServices',
        '/rest/services/timeline,',
        queryParameters);

    final response_onecall = await http.get(uri);

    print(response_onecall.body);

    final json = jsonDecode(response_onecall.body);
    return WeatherResponseOnecall.fromJson(json);
  }
}

我遇到了这样的错误。

E/flutter (11332): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: FormatException: Invalid character (at character 27)
E/flutter (11332): weather.visualcrossing.com/VisualCrossingWebServices
E/flutter (11332):                           ^
E/flutter (11332):
E/flutter (11332): #0      _Uri._fail (dart:core/uri.dart:1754:5)
E/flutter (11332): #1      _Uri._normalizeRegName (dart:core/uri.dart:2252:9)
E/flutter (11332): #2      _Uri._makeHost (dart:core/uri.dart:2113:12)
E/flutter (11332): #3      new _Uri (dart:core/uri.dart:1640:12)
E/flutter (11332): #4      _Uri._makeHttpUri (dart:core/uri.dart:1813:12)
E/flutter (11332): #5      new _Uri.https (dart:core/uri.dart:1678:12)
E/flutter (11332): #6      DataServiceOneCall.getWeatherOneCall package:weather_app/data_service/data_service_onecall.dart:18

感谢您的帮助。

斜杠后的V会很小

final uri = Uri.https(
    'weather.visualcrossing.com/visualCrossingWebServices',
    '/rest/services/timeline,',

我像这样重写这段代码并且它有效。

final uri = Uri.https(
        'weather.visualcrossing.com',
        '/VisualCrossingWebServices/rest/services/timeline/${city}?',
        queryParameters);