post method
Utility method to make a custom http post call with the Api Key added to the headers
Implementation
Future<Response> post({
String path = '',
Map<String, String>? headers,
Map<String, dynamic>? params,
Map<String, dynamic>? data,
}) async {
// return await call('post', path: path, headers: headers, data: data);
headers ??= {};
headers.addAll({
'content-type': 'application/json',
'X-APIKEY': apiKey,
});
try {
return await _client.post(_getUriUrl(basePath + path, params),
headers: headers, body: json.encode(data));
} catch (e) {
if (e is HolodexException) {
rethrow;
}
throw HolodexException(e.toString());
}
}