niceJson function
Encodes data
as nicely formatted human-readable JSON.
indent
is the indent character added to the start of each line. By default,
this is a single space, but other good options are two spaces or a tab ('\t').
maxContentLength
is the maximum length of a single entry.
maxLineLength
is the maximum length of a single line, including key and indent.
Any keys in alwaysExpandKeys
will have their values expanded, regardless
of line length.
Implementation
String niceJson(
Map<String, dynamic> data, {
String indent = ' ',
int maxContentLength = 40,
int maxLineLength = 80,
List<String> alwaysExpandKeys = const [],
int minDepth = 1,
}) {
return encodeObject(
data,
JsonOptions(
indent: indent,
maxContentLength: maxContentLength,
maxLineLength: maxLineLength,
alwaysExpandKeys: alwaysExpandKeys,
minDepth: minDepth,
),
);
}