postData method
Future<Response?>
postData(
- String endpoint,
- dynamic data, {
})
Implementation
Future<Response?> postData(String endpoint, dynamic data,
{Map<String, dynamic>? headers}) async {
try {
_dio.options.headers['content-Type'] = 'application/json';
_dio.options.headers['authorization'] = _bearerToken;
final response = await _dio.post(
Uri.encodeFull(endpoint),
data: data,
options: Options(headers: headers),
);
return response;
} on DioError catch (e) {
throw handleException(e);
} catch (e) {
print("ERROR postData $e");
throw Exception(e);
}
}