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


I am using dart:http to make post request but it seems I cannot specify HTTP1.1 version which is required by target api. Ideally I need to re-create following request in dart:

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

My current version is this:

    final url = Uri.parse('');

    final response = await, 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
    headers: <String, String>{
      'Authorization': '000000-000000-000000-000000',
      'accept': 'text/plain',
      'Content-Type': 'application/json'
    body: data,
return response;

Answered By – Mohamed Mesalm

Answer Checked By – Mildred Charles (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *