fromJson static method

String fromJson(
  1. Object data, {
  2. String? indent,
  3. bool toStringEncodable = false,
})

Converts a Dart object represented as a Map to a JSON-encoded string.

The input data is a Map representing the Dart object.

Implementation

static String fromJson(Object data,
    {String? indent, bool toStringEncodable = false}) {
  if (indent != null) {
    return JsonEncoder.withIndent(
            indent, toStringEncodable ? (c) => c.toString() : null)
        .convert(data);
  }
  return jsonEncode(data,
      toEncodable: toStringEncodable ? (c) => c.toString() : null);
}