fromJson static method

String fromJson(
  1. Object data, {
  2. String? indent,
  3. bool toStringEncodable = false,
  4. Object? toEncodable(
    1. dynamic
    )?,
  5. JsonEncodeOptions? options,
})

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,
  Object? Function(dynamic)? toEncodable,
  JsonEncodeOptions? options,
}) {
  if (toStringEncodable) {
    toEncodable ??= (c) => c.toString();
  }
  return JsonCodec.jsonEncode(
    data,
    toEncodable: toEncodable,
    options: options,
    indent: indent,
  );
}