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