send<T> method
Method to send the API request
Implementation
Future<Response> send<T>() async {
try {
SharedPreferences sharedPreferences =
await SharedPreferences.getInstance();
Response data = await dio.request<T>(
url,
data: body,
options: options ??
Options(method: method ?? ApiMethod.GET, headers: {
'Authorization':
'Bearer ${sharedPreferences.getString("pb_token")}'
}),
);
return data;
} on DioException catch (e) {
throw PocketBaseException(
errorCode: e.response?.statusCode,
message: e.message,
response: e.response?.data,
);
} catch (e) {
rethrow;
}
}