How to make HTTP POST request with url encoded body in flutter?

前端 未结 8 1463
南笙
南笙 2020-12-01 03:59

I\'m trying to make an post request in flutter with content type as url encoded. When I write body : json.encode(data), it encodes to plain text.

If I

8条回答
  •  失恋的感觉
    2020-12-01 04:11

    Map body = {
      'getDetails': 'true'
    };
    
    final response = await 
    http.post("https://example.com/", body: body);
    
    if (response.statusCode == 200) {
    //Your code
    }
    

提交回复
热议问题