serializer property

FutureOr<String> Function(dynamic) serializer
read / write

Serializes response data into a String.

The default is conversion into JSON via json.encode.

If you are 100% sure that your response handlers will only be JSON-encodable objects (i.e. primitives, Lists and Maps), then consider setting serializer to JSON.encode.

To set it globally for the whole app, use the following helper:

app.injectSerializer(JSON.encode);

Implementation

FutureOr<String> Function(dynamic) serializer = c.json.encode;