get<T> method

Future<Response<T>> get<T>(
  1. String url,
  2. {Map<String, String>? headers,
  3. String? contentType,
  4. Map<String, dynamic>? query,
  5. Decoder<T>? decoder}
)

Implementation

Future<Response<T>> get<T>(
  String url, {
  Map<String, String>? headers,
  String? contentType,
  Map<String, dynamic>? query,
  Decoder<T>? decoder,
}) async {
  try {
    var response = await _performRequest<T>(
      () => _get<T>(url, contentType, query, decoder),
      headers: headers,
    );
    return response;
  } on Exception catch (e) {
    if (!errorSafety) {
      throw GetHttpException(e.toString());
    }
    return Future.value(Response<T>(
      statusText: 'Can not connect to server. Reason: $e',
    ));
  }
}