“Flutter envoie JSON Body à l'API” Réponses codées

Flutter envoie JSON Body à l'API

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

Envoyer JSON Body http Get Flutter

final queryParameters = {
  'name': 'Bob',
  'age': '87',
};
final uri = Uri.http('www.example.com', '/path', queryParameters);
final headers = {HttpHeaders.contentTypeHeader: 'application/json'};
final response = await http.get(uri, headers: headers);
Agreeable Antelope

Réponses similaires à “Flutter envoie JSON Body à l'API”

Questions similaires à “Flutter envoie JSON Body à l'API”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code