如何指定Flutter/dart HTTP协议版本(HTTP/1.1, --http1.1)

How to specify Flutter/dart HTTP protocol version (HTTP/1.1, --http1.1)

我正在使用 dart:http 发出 post 请求,但我似乎无法指定目标 api 所需的 HTTP1.1 版本。理想情况下,我需要在飞镖中重新创建以下请求:

curl -X POST --http1.1 "https://api.dummyapi.com/v1/route" -H "accept: text/plain" -H "Authorization: 000000-000000-000000-000000" -H "Content-Type: application/json-patch+json" -d "{}"

我当前的版本是这样的:

    final url = Uri.parse('https://api.dummyapi.com/v1/route');

    final response = await http.post(url, headers: {
      'Authorization': '000000-000000-000000-000000',
      'accept': 'text/plain',
      'Content-Type': 'application/json'
    });```
Checked the following code example



  Future createUserExample(Map<String,dynamic> data) async {
final http.Response response = await http.post(
    'https://api.dummyapi.com/v1/route',
    headers: <String, String>{
      'Authorization': '000000-000000-000000-000000',
      'accept': 'text/plain',
      'Content-Type': 'application/json'
    },
    body: data,
);
return response;