packageApitoStorageJson static method

String packageApitoStorageJson(
  1. PackageApi packageApi, {
  2. bool pretty = false,
})

writes the packageApi to storage (JSON string)

Implementation

static String packageApitoStorageJson(
  PackageApi packageApi, {
  bool pretty = false,
}) {
  final packageApiStorage = _packageApiToStorage(packageApi);
  final encoder = pretty ? JsonEncoder.withIndent('    ') : JsonEncoder();
  return encoder.convert({
    'version': 3,
    'packageApi': packageApiStorage.toJson(),
    'missingEntryPoints': packageApi
        .rootDeclarationsWithoutEntryPointsAndVisibleOutsideTests
        .map((e) => e.name)
        .toList(),
  });
}