So I'm trying to get the access token from the Instagram API. it shows in Postman but it doesn't show up in the response body

    onPageStarted: (url) async {
      print("url is " + url);

      if (url
          .startsWith("")) {
        var uri = Uri.parse(url);
        final String? code = uri.queryParameters["code"];
        print("this's the code: $code");
        final response = await dio
            .post('', data: {
          'client_id': Constants.igClientId,
          'client_secret': Constants.igClientSecret,
          'grant_type': "authorization_code",
          'redirect_uri': Constants.igRedirectURL,
          'code': code

        print("token is => ${}");
        print("response => ${response.statusCode} ${}");

here's the log:

I/flutter (21891): url is
I/flutter (21891): this's the code: AQDIXj5sEEPfgHv_U5dcw3A9zQbWjR9w37MTWg9f153UAJsyHcG34iNtSgxH9sswpBvHrB1CobZBgReCx4GhCIeq5HiLfIDRe8c_HNS_U_7CQ5fVdP6JdS1vLxQua4iA706q9lik08r_C9aAFLm6oT0hJeQVXcHiwTqJWLxxyXxWhtmeClBYwlIoSJKp8gcf-rft6QrVOolBcXg6LCB6Vj9W7Dr3k4QiqsDVN0vX2uvAsw
I/flutter (21891): token is =>
I/flutter (21891): response => 200

I fixed it. the problem was in dio.options() I added this: Options(responseType: ResponseType.json)

Solution 1: Stijn2210

Add “Content-Type”: “application/json” and “Accept”: “application/json” to the headers parameters of your method

Solution 2: M Imam Pratama

According to the package example, you should use if you want to print it.

If you want to use it, properly decode it first.