Returns decoded data as Map
if decoding has already occurred.
If decoding has not yet occurred, this method throws an HTTPBodyDecoderException.
If decoding as occurred, behavior is the same as decodeAsMap, but the result is not wrapped in Future
.
Source
Map<String, dynamic> asMap() { if (!hasBeenDecoded) { throw new HTTPBodyDecoderException("asMap() invoked, but has not been decoded yet."); } if (_decodedData == null) { return null; } var d = _decodedData as List<Map<String, dynamic>>; if (d.length != 1) { throw new HTTPBodyDecoderException("asMap() failed: more than one object in 'decodedData'."); } var firstObject = d.first; if (firstObject is! Map<String, dynamic>) { throw new HTTPBodyDecoderException("asMap() invoked on non-Map<String, dynamic> data."); } return firstObject; }