asString property
String?
asString
Implementation
String? get asString {
if (isString) {
return _body as String;
} else if (isByteBuffer) {
var bytes = _body as ByteBuffer;
var bits16 = mimeType != null && mimeType!.isCharsetUTF16;
var bytesLists = bits16 ? bytes.asUint16List() : bytes.asUint8List();
return String.fromCharCodes(bytesLists);
} else if (isBytesArray) {
var a = _body as List<int>;
return String.fromCharCodes(a);
} else if (isMap) {
return json.encode(_body);
} else {
return null;
}
}