jsonEncode static method

String jsonEncode(
  1. Object? object, {
  2. Object? toEncodable(
    1. Object? object
    )?,
  3. JsonEncodeOptions? options,
  4. String? indent,
})

options is fully optional: leave it null (the default) for behavior identical to dart:convert's jsonEncode - pass one to opt into the BigInt/JsonBinary features (see the library doc above).

indent, if given (e.g. ' ' or '\t'), pretty-prints the output with a newline + that many indent units per nesting level, instead of the default compact single-line output.

Implementation

static String jsonEncode(
  Object? object, {
  Object? Function(Object? object)? toEncodable,
  JsonEncodeOptions? options,
  String? indent,
}) {
  final buf = StringBuffer();
  _encodeValue(buf, object, toEncodable, options, <Object?>[], indent, 0);
  return buf.toString();
}