toJson method

Map<String, dynamic> toJson()

Serializes this bundle to a JSON-compatible map.

The resulting map includes format version, entry point URI, and all module ASTs keyed by their URI. When sources is non-null, the map also includes source code keyed by module URI.

Implementation

Map<String, dynamic> toJson() => {
  AstBundleFormat.keyVersion: AstBundleFormat.version,
  AstBundleFormat.keyEntryPoint: entryPointUri,
  AstBundleFormat.keyModules: modules.map(
    (uri, cu) => MapEntry(uri, cu.toJson()),
  ),
  if (sources != null) AstBundleFormat.keySources: sources,
};