Отправить JSON в API Flutter Post

Future<http.Response> createFunction(String str) {
  return http.post(
    Uri.parse('https://your_domain.com/path'),
    headers: <String, String>{
      'Content-Type': 'application/json; charset=UTF-8',
    },
    body: jsonEncode(<String, String>{
      'str': str,
    }),
  );
}
Snippets