Returns decoded data as a List
of bytes if decoding has already been attempted.
If decoding has not yet occurred, this method throws an HTTPBodyDecoderException.
If decoding as occurred, behavior is the same as decodeAsBytes, but the result is not wrapped in Future
.
Source
List<int> asBytes() { if (!hasBeenDecoded) { throw new HTTPBodyDecoderException("asBytes() invoked, but has not been decoded yet."); } if (_bytes != null) { return _bytes; } if (_decodedData == null) { return null; } if (_decodedData.first is! int) { throw new HTTPBodyDecoderException("asBytes() expected list of bytes, instead got List<${_decodedData.first.runtimeType}>"); } return _decodedData as List<int>; }