parseJson static method
Parses the JSON data of a package configuration file.
The configuration
must be a JSON-like Dart data structure,
like the one provided by parsing JSON text using dart:convert
,
containing a valid package configuration.
The baseUri
is used as the base for resolving relative
URI references in the configuration file. If the configuration
has been read from a file, the baseUri
can be the URI of that
file, or of the directory it occurs in.
If onError
is provided, errors found during parsing or building
the configuration are reported by calling onError
instead of
throwing, and parser makes a best effort attempt to continue
despite the error. The input must still be valid JSON.
The result may be PackageConfig.empty if there is no way to
extract useful information from the bytes.
Implementation
static PackageConfig parseJson(Object? jsonData, Uri baseUri,
{void Function(Object error)? onError}) =>
parsePackageConfigJson(jsonData, baseUri, onError ?? throwError);