convertDecode function

dynamic convertDecode(
  1. String source,
  2. {Reviver? reviver}
)

Parses the string and returns the resulting Json object.

The optional reviver function is called once for each object or list property that has been parsed during decoding. The key argument is either the integer list index for a list property, the string map key for object properties, or null for the final result.

The default reviver (when not provided) is the identity function.

Throws an ArgumentError if source is null.

Throws a JsonFormatException is source does not represent any JSON data.

Implementation

dynamic convertDecode(String source, {Reviver? reviver}) {
  try {
    return json.decode(source, reviver: reviver);
  } on FormatException catch (e) {
    throw JsonFormatException.fromParent(e);
  }
}