toStructuredString method

String toStructuredString({
  1. String stringQuote = "'",
  2. String keyQuote = '',
  3. bool withTypes = false,
  4. int tabWidth = 2,
})

Converts any object to a human-readable structured string.

You can use the stringQuote and keyQuote parameters to specify the quotes character for keys and string values. For ease of debugging, it is convenient to use withTypes. It shows types for all data. tabWidth defines the width of the tabs.

Lists with simple elements of the same type are shown on one line. The same is true for sets. Map entries are always shown each on a separate line.

Implementation

String toStructuredString(
        {String stringQuote = "'",
        String keyQuote = '',
        bool withTypes = false,
        int tabWidth = 2}) =>
    _toStructuredString(
        value: this,
        parentIsSimpleList: false,
        stringQuote: stringQuote,
        keyQuote: keyQuote,
        withTypes: withTypes,
        tabWidth: tabWidth,
        level: 0);