post<T> method
Base HTTP post request.
By default it will store data in apiCacheStorage with endPointURL
as Storage Key.
Implementation
Future<T?> post<T>({required String endPointURL, Map<String, dynamic>? data, Map<String, dynamic>? header, bool addToCache = true}) async {
Response response = await _dio.post(endPointURL, data: data, options: Options(headers: header));
if (response.statusCode == 200) {
if (addToCache) _storage.write(endPointURL, response.data);
return response.data;
} else {
return null;
}
}