postRequest static method
Implementation
static Future<dynamic> postRequest(Map map, String api,
{Map<String, String>? header}) async {
var url = Uri.parse('$apiEndpoint/$api');
try {
http.Response response = await http.post(url, body: map, headers: header);
if (response.statusCode == 200) {
String data = response.body;
var decodedData = jsonDecode(data);
return decodedData;
} else {
return 'failed';
}
} catch (e) {
throw Exception('No internet connectivity');
}
}