sendFormEncodedRequest method

  1. @override
Future sendFormEncodedRequest({
  1. required String endPoint,
  2. required Map<String, dynamic> param,
  3. required Map<String, dynamic> headers,
  4. IDSMethodType method = IDSMethodType.post,
})
override

Sends an HTTP request with application/x-www-form-urlencoded content type.

This method is useful when interacting with servers that expect data in form-encoded format (like traditional web forms).

Example usage:

final response = await apiManager.sendFormEncodedRequest(
  endPoint: "https://example.com/api/submit",
  param: {
    'username': 'john_doe',
    'password': 'secret123'
  },
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded'
  },
);

endPoint - The full URL of the API endpoint. param - Key-value pairs to be sent as form data. headers - HTTP headers, must include 'Content-Type': 'application/x-www-form-urlencoded'. method - HTTP method, default is IDSMethodType.post.

Returns a Future that resolves to the response data.

Implementation

@override
Future<dynamic> sendFormEncodedRequest({
  required String endPoint,
  required Map<String, dynamic> param,
  required Map<String, dynamic> headers,
  IDSMethodType method = IDSMethodType.post,
}) {
  return _sendFormEncodedRequest(
    endPoint: endPoint,
    param: param,
    headers: headers,
    method: method,
  );
}