parse function

Mapping parse(
  1. String jsonMap, {
  2. Map<String, Map>? otherMaps,
  3. Object? mapUrl,
})

Parses a source map directly from a json string.

mapUrl, which may be either a String or a Uri, indicates the URL of the source map file itself. If it's passed, any URLs in the source map will be interpreted as relative to this URL when generating spans.

Implementation

// TODO(sigmund): evaluate whether other maps should have the json parsed, or
// the string represenation.
// TODO(tjblasi): Ignore the first line of [jsonMap] if the JSON safety string
// `)]}'` begins the string representation of the map.
Mapping parse(String jsonMap,
        {Map<String, Map>? otherMaps, /*String|Uri*/ Object? mapUrl}) =>
    parseJson(jsonDecode(jsonMap) as Map, otherMaps: otherMaps, mapUrl: mapUrl);