jsonPretty method

String jsonPretty({
  1. String indent = defaultJsonIndent,
})

Json encode an object with supplied indent or defaultJsonIndent

If conversion failed, return error as String and NOT throw.

Implementation

String jsonPretty({String indent = defaultJsonIndent}) {
  try {
    return JsonEncoder.withIndent(indent).convert(this);
  } catch (e) {
    return 'jsonPretty() failed: $e';
  }
}