web api post method do not work in flutter

Issue

I did everything which i found in internet, but still its not working…

The web api is .net core 5

http.Response response = await http.post(
        Uri.parse(ss),
        headers:
        {
          "Access_Control_Allow_Methods": "POST, OPTIONS",
          "Content-Type": "application/json",
          "Access-Control-Allow-Origin": "*",
          "Access-Control-Allow-Credentials": 'true'
        },
        body: _buyBasket
    );

Solution

you must change your API .net core to .net core 6.0 to resolve your problem
happy code

Answered By – Arash Ghazi

Answer Checked By – Jay B. (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *