get method
Sends a GET request to the specified uri.
uri: The endpoint to which the GET request is sent.
queryParameters: Optional query parameters.
options: Optional request options.
cancelToken: A token to cancel the request.
onReceiveProgress: A callback for tracking response progress.
Returns the response data.
Throws Exceptions if response data is invalid,
Implementation
Future<dynamic> get(
String uri, {
Map<String, dynamic>? queryParameters,
Options? options,
CancelToken? cancelToken,
ProgressCallback? onReceiveProgress,
}) async {
try {
var response = await _dio.get(
uri,
queryParameters: queryParameters,
options: options,
cancelToken: cancelToken,
onReceiveProgress: onReceiveProgress,
);
return response.data;
} on SocketException catch (e) {
throw SocketException(e.toString());
} on FormatException catch (_) {
throw const FormatException("Unable to process the data");
} catch (e) {
rethrow;
}
}