parse method

  1. @override
Future<T?> parse()
override

Implementation

@override
Future<T?> parse() async {
  if (_parsing != null) return _parsing!.future;
  _parsing = Completer<T?>();
  try {
    final String rawData = _data != null ? _data! : await _decodeBody();
    _data = rawData;
    final result = resultParser.convert(ResponseResultParserParam(
        data: rawData,
        headers: response.headers,
        status: response.statusCode,
        path: path));
    _parsing?.complete(result);
  } on Exception {
    if (_parsing != null) _parsing!.complete(null);
    _parsing = null;
    rethrow;
  }
  return _parsing?.future;
}