Unable to process the return parameter

Custom Code

I created a custom action to get login to accu360 erp but I'm not getting cookie's data.

I'm getting body data but not headers data. Basically I need Set-Cookie.

Thank you in advance. I'm totally new in flutterflow and in android app development.

here is my code

import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';

Future<String> loginToaccu360(String usr, String pwd) async {
  final String apiUrl =
      'https://baseurl/api/method/login'; //

  try {
    // Send a POST request with 'usr' and 'pwd' parameters
    final response = await http.post(
      Uri.parse(apiUrl),
      body: {
        'usr': usr, // Username parameter
        'pwd': pwd, // Password parameter
      },
    );

    // Check if the response is successful (status code 200)
    if (response.statusCode == 200) {
      // Extract the 'Set-Cookie' header from the response
      var cookies = response.headers['set-cookie'];

      // If cookies are found, save the session cookie
      if (cookies != null) {
        // Save the cookie in SharedPreferences for use in future requests
        SharedPreferences prefs = await SharedPreferences.getInstance();
        await prefs.setString('session_cookie', cookies); // Save the cookie

        // Return a message with the cookie data
        return 'Login successful. Cookie: $cookies';
      } else {
        return 'Login successful, but no cookies found.';
      }
    } else {
      // Return an error message if login failed
      return 'Failed to login: ${response.statusCode}';
    }
  } catch (e) {
    // Return an error message if an exception occurs
    return 'Error: ${e.toString()}';
  }
}
What have you tried so far?

I tried the above code and also I got all the response in Postman but not in flutterflow.

Did you check FlutterFlow's Documentation for this topic?
No
1