post method
Implementation
@override
Future<Map<String, dynamic>> post(String api, Map<String, dynamic>? headers,
Map<String, dynamic> body) async {
try {
final request = await _httpClient.postUrl(_makeUri(api, null));
_addHeader(request, headers);
request.add(
utf8.encode(
jsonEncode(
body,
),
),
);
final response = await request.close();
if (response.statusCode == 200) {
final responseBody = await response.transform(utf8.decoder).join();
return json.decode(responseBody) as Map<String, dynamic>;
}
throw (response.statusCode);
} catch (error) {
rethrow;
}
}