get method

  1. @override
Future<ParseNetworkResponse> get(
  1. String path, {
  2. ParseNetworkOptions? options,
  3. ProgressCallback? onReceiveProgress,
})
override

Implementation

@override
Future<ParseNetworkResponse> get(
  String path, {
  ParseNetworkOptions? options,
  ProgressCallback? onReceiveProgress,
}) async {
  try {
    final dio.Response<String> dioResponse = await _client.get<String>(
      path,
      options: _Options(headers: options?.headers),
    );

    return ParseNetworkResponse(
      data: dioResponse.data!,
      statusCode: dioResponse.statusCode!,
    );
  } on dio.DioException catch (error) {
    return ParseNetworkResponse(
      data: error.response?.data ?? _fallbackErrorData,
      statusCode: error.response?.statusCode ?? ParseError.otherCause,
    );
  }
}