dart - http post request doesn't work for my flutter app code - Stack Overflow

PHOTO EMBED

Fri Jun 17 2022 15:26:07 GMT+0000 (UTC)

Saved by @jaystiqs #dart

postData() async {
    try {
      var response = await http.post(
          Uri.parse("https://zen-api-1010.azure-api.net/notes/v1/create"),
          headers: {
            "Content-type": "application/json",
            "Accept": "application/json",
            "Ocp-Apim-Subscription-Key": "008c47b597e54aedadbd5e4d270b35ed",
            "Ocp-Apim-Trace": "true"
          },
          body: jsonEncode({
            "noteType": 0.toString(),
            "description": "KUSHAN  1".toString(),
            "authorReaction": 0.toString(),
            "privacy": 0.toString(),
          }));
      print(response.statusCode);
    } catch (e) {
      print(e);
    }
  }
content_copyCOPY

https://stackoverflow.com/questions/69092164/http-post-request-doesnt-work-for-my-flutter-app-code