String encode(Object val, { bool pretty: false })

Source

static String encode(Object val, {bool pretty: false}) {
  return instance.encodeJson(val, pretty: pretty);
}