response property

dynamic get response

The data received as a reponse from the request.

The data could be in the form of a String, ByteBuffer, Document, Blob, or json (also a String). null indicates request failure.

Implementation

dynamic get response {
  final data = _responseData;
  if (data == null) {
    return null;
  }
  switch (responseType) {
    case 'arraybuffer':
      return data.buffer;
    case 'blob':
      return Blob([data]);
    case 'json':
      return json.decode(utf8.decode(data));
    case 'text':
      return utf8.decode(data);
    default:
      throw UnsupportedError('Response type "$responseType" is unsupported');
  }
}