JSON encodes a serialized value into body and sets contentType.
This method will encode v
as JSON data and set it as the body of this request. v
must be
encodable to JSON (Map
s, List
s, String
s, int
s, etc.). The contentType
will be set to ContentType.JSON
.
Source
set json(dynamic v) { body = JSON.encode(v); contentType = ContentType.JSON; }