decodedBody property

dynamic decodedBody

The HTTP response body decoded according to its Content-Type.

Prefer to use bodyDecoder.

Decoding is performed by bodyDecoder.

Implementation

dynamic get decodedBody {
  if (bodyDecoder.isEmpty) {
    return null;
  }

  if (reflectType(bodyDecoder.decodedType).isSubtypeOf(reflectType(Map))) {
    return bodyDecoder.asMap();
  } else if (reflectType(bodyDecoder.decodedType)
      .isSubtypeOf(reflectType(String))) {
    return bodyDecoder.asString();
  } else if (reflectType(bodyDecoder.decodedType)
      .isSubtypeOf(reflectType(List))) {
    return bodyDecoder.asList();
  }

  return bodyDecoder.asBytes();
}