encode method

String encode(
  1. dynamic obj, {
  2. bool beautify = false,
  3. int indent = 2,
  4. dynamic jsonBooleans = false,
  5. dynamic quoteMapKeys = false,
})

Encode gson

gson.encode({"hello": "world"}) // >> {hello: "world"}

for beautier gson

gson.encode({"hello": "world"},beautify: true);
// >> {
// >>   hello: "world"
// >> }

You can also set the indent (the amount of spaces the gson is indented with)

Implementation

String encode(dynamic obj,
    {bool beautify = false,
    int indent = 2,
    jsonBooleans = false,
    quoteMapKeys = false}) {
  return encoder.encode(obj,
      beautify: beautify,
      indent: indent,
      jsonBooleans: jsonBooleans,
      quoteMapKeys: quoteMapKeys);
}