An object representing the body of the Response, which will be encoded when used to Request.respond.
This is typically a map or list of maps that will be encoded to JSON. If the body was previously set with a HTTPSerializable object or a list of HTTPSerializable objects, this property will be the already serialized (but not encoded) body.
Source
dynamic get body => _body;
Sets the unencoded response body.
This may be any value that can be encoded into an HTTP response body. If this value is a HTTPSerializable or a List
of HTTPSerializable,
each instance of HTTPSerializable will transformed via its HTTPSerializable.asMap method before being set.
Source
set body(dynamic initialResponseBody) { var serializedBody; if (initialResponseBody is HTTPSerializable) { serializedBody = initialResponseBody.asMap(); } else if (initialResponseBody is List) { serializedBody = initialResponseBody.map((value) { if (value is HTTPSerializable) { return value.asMap(); } else { return value; } }).toList(); } _body = serializedBody ?? initialResponseBody; }