asByteBuffer property
ByteBuffer?
get
asByteBuffer
Implementation
ByteBuffer? get asByteBuffer {
final body = _body;
if (body is ByteBuffer) {
return body;
} else if (body is List<int>) {
if (body is TypedData) {
return (body as TypedData).buffer;
} else {
return Uint8List.fromList(body).buffer;
}
} else if (body is String) {
return body.toByteBuffer(encoding: mimeType?.preferredStringEncoding);
} else if (isMap) {
var s = asString!;
return s.toByteBuffer();
}
return null;
}