writeJson static method
CappConsole
writeJson(
- dynamic json, {
- bool pretty = false,
- CappColors color = CappColors.none,
- int indent = 4,
- String indantChar = ' ',
Implementation
static CappConsole writeJson(
dynamic json, {
bool pretty = false,
CappColors color = CappColors.none,
int indent = 4,
String indantChar = ' ',
}) {
if (pretty) {
var encoder = JsonEncoder.withIndent(
indantChar * indent,
(object) {
return object.toString();
},
); // Indent with two spaces
var res = encoder.convert(json);
return write(res, color);
} else {
var res = jsonEncode(json);
return write(res, color);
}
}