bytes property

Uint8List get bytes

Converts the body to bytes for HTTP response

Implementation

Uint8List get bytes {
  if (body is Uint8List) return body as Uint8List;
  if (body is String) return utf8.encode(body as String);
  if (body is List<int>) return Uint8List.fromList(body as List<int>);
  return Uint8List(0);
}