post static method
Implementation
static Future<dynamic> post({
required bool auth,
required Map<String, dynamic> data,
String? baseURL,
required String apiURL,
required String lang,
}) async {
try {
var response = await http
.post(Uri.parse((baseURL ?? ApiClient.baseUrl) + apiURL),
body: jsonEncode(data),
headers: ApiClient.headers(auth: auth, lang: lang))
.timeout(const Duration(seconds: timeOutDuration));
return ApiClient.processResponse(response);
} on SocketException {
throw FetchDataException('No Internet connection', '');
} on TimeoutException {
throw ApiNotRespondingException('API not responded in time', '');
}
}