toJson method

Map<String, Object?> toJson()

JSON-like representation for debug surfaces.

Implementation

Map<String, Object?> toJson() {
  final List<String> platformKinds = platformSourceKinds.toList()..sort();
  final List<Map<String, Object?>> platformMatrix =
      _platformContracts.entries
          .map(
            (MapEntry<String, PixaPlatformContract> entry) =>
                <String, Object?>{
                  'handlerId': entry.key,
                  ...entry.value.toJson(),
                },
          )
          .toList()
        ..sort(
          (Map<String, Object?> left, Map<String, Object?> right) =>
              (left['handlerId']! as String).compareTo(
                right['handlerId']! as String,
              ),
        );
  return <String, Object?>{
    'fetcherRoutes': fetcherRoutes,
    'decoderMimeRoutes': decoderMimeRoutes,
    'decoderFormatRoutes': decoderFormatRoutes,
    'decoderSignatureRoutes': decoderSignatureRoutes,
    'processorRoutes': processorRoutes,
    'cacheStoreRoutes': cacheStoreRoutes,
    'platformHandlers': platformHandlers,
    'platformSourceKinds': platformKinds,
    'platformCapabilityMatrix': platformMatrix,
    'adaptivePluginIntegrations': _adaptiveIntegrations
        .map((PixaPluginIntegrationSelection selection) => selection.toJson())
        .toList(),
    'executionLaneHandlers': <String, Object?>{
      'runtime': architecture.runtimeHandlers,
      'dart': architecture.dartHandlers,
      'platform': architecture.platformHandlers,
      'external': architecture.externalHandlers,
    },
    'defaultHotPathUsesRuntimeOnly': defaultHotPathUsesRuntimeOnly,
  };
}