json<ST> static method
StringResponse
json<
ST>( - ST value, {
- dynamic serializeWith(
- ST value
)?,
- int statusCode = HttpStatus.ok,
- String mimeType = MimeTypes.json,
- String charset = kDefaultCharset,
- List<Cookie>? cookies,
})
Implementation
static StringResponse json<ST>(
ST value, {
dynamic serializeWith(ST value)?,
int statusCode = HttpStatus.ok,
Map<String, dynamic>? headers,
String mimeType = MimeTypes.json,
String charset = kDefaultCharset,
List<Cookie>? cookies,
}) {
String body =
cnv.json.encode(serializeWith == null ? value : serializeWith(value));
return StringResponse(
body: body,
statusCode: statusCode,
headers: headers,
mimeType: mimeType,
charset: charset,
cookies: cookies,
);
}