prettyJson function

String prettyJson(
  1. dynamic json, {
  2. int indent = 2,
})

prettyJson Return a formatted, human readable, string.

Takes a json object and optional indent size, returns a formatted String

@Map<String,dynamic> json @int indent

Implementation

String prettyJson(dynamic json, {int indent = 2}) {
  var spaces = ' ' * indent;
  var encoder = JsonEncoder.withIndent(spaces);
  return encoder.convert(json);
}