sendFormEncodedRequest method
Sends a form URL-encoded HTTP request through the internal API manager.
This method is used to send data in the application/x-www-form-urlencoded
format,
which is typically required by legacy systems or certain APIs (e.g., ASP.NET Web Services).
It supports multiple HTTP methods (default is POST) and automatically delegates the request
to the _apiManagerImpl.sendFormEncodedRequest
implementation.
Parameters:
endPoint
– The full URL endpoint to which the request is sent.param
– A map of form data to be sent in the request body.headers
– A map of HTTP headers to include in the request. It is recommended to include'Content-Type': 'application/x-www-form-urlencoded'
.method
– The HTTP method to be used (default isIDSMethodType.post
).
Returns:
A Future
that resolves to the parsed response from the server, typically a Map<String, dynamic>
or error metadata if the request fails.
Example:
final response = await sendFormEncodedRequest(
endPoint: 'https://example.com/api/checkStatus',
param: {
'Vehicle_No': 'MH46CU4108',
'Branch_Code': '11',
'FormMode': 'Add',
},
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
);
print(response);
Implementation
Future<dynamic> sendFormEncodedRequest({
required String endPoint,
required Map<String, dynamic> param,
required Map<String, dynamic> headers,
IDSMethodType method = IDSMethodType.post,
}) async =>
_apiManagerImpl.sendFormEncodedRequest(
endPoint: endPoint,
param: param,
headers: headers,
);