get<T> method

Future<T?> get<T>(
  1. String url, {
  2. Object? data,
  3. Map<String, String>? queryParameters,
  4. Options? options,
  5. CancelToken? cancelToken,
  6. ProgressCallback? onReceiveProgress,
})

Make a GET request

Implementation

Future<T?> get<T>(
  String url, {
  Object? data,
  Map<String, String>? queryParameters,
  Options? options,
  CancelToken? cancelToken,
  ProgressCallback? onReceiveProgress,
}) async {
  Uri uri = Uri.parse(url);
  if (queryParameters != null) {
    uri = uri.replace(queryParameters: queryParameters);
  }
  if (T.toString() == 'dynamic') {
    return await network(
      request: (request) => request.getUri(uri,
          data: data,
          options: options,
          cancelToken: cancelToken,
          onReceiveProgress: onReceiveProgress),
    );
  }
  return await network<T>(
    request: (request) => request.getUri(uri,
        data: data,
        options: options,
        cancelToken: cancelToken,
        onReceiveProgress: onReceiveProgress),
  );
}