JsonFormatter.withIndent constructor

JsonFormatter.withIndent(
  1. int indent, {
  2. bool useTabs = false,
  3. LevelFormatter<Object> formatLevel = _formatLevel,
  4. TimestampFormatter<Object> formatTimestamp = _formatTimestamp,
})

Creates a new JsonFormatter with specified indent level.

By default produced JSON is indented with space character, however it is possible to use tabs instead by setting useTabs to true.

Optional formatLevel and formatTimestamp callbacks may be provided and are used to format severity levels and timestamp.

Implementation

factory JsonFormatter.withIndent(int indent,
        {bool useTabs = false,
        LevelFormatter<Object> formatLevel = _formatLevel,
        TimestampFormatter<Object> formatTimestamp = _formatTimestamp}) =>
    JsonFormatter._(JsonEncoder.withIndent(useTabs ? '\t' : ' ' * indent),
        formatLevel, formatTimestamp);