Http POST request with json content-type in dart:io
This is a complete example. You have to use json.encode(…) to convert the body of your request to JSON. import ‘package:http/http.dart’ as http; import ‘dart:convert’; import ‘dart:io’; var url = “https://someurl/here”; var body = json.encode({“foo”: “bar”}); Map<String,String> headers = { ‘Content-type’ : ‘application/json’, ‘Accept’: ‘application/json’, }; final response = http.post(url, body: body, headers: headers); final … Read more