dart

code for encode a json before sending to an api in flutter

//encode json 

String jsonString = json.encode(jsonMap);

//send to api

http.post(url, body: jsonString).then((response) {
  //handle response
});
Was this helpful?