BundleUiReadAdapter class

Read adapter that implements UiPort from mcp_bundle.

Converts a loaded McpBundle into runtime-consumable UI definition JSON. All UI file I/O goes through mcp_bundle's reserved-folder API (McpBundle.uiResources) — never dart:io directly. The bundle is the single owner of file access; this adapter is just the translator between bundle bytes and the runtime's JSON shape.

Resolution order

  1. Snapshot layout (canonical): when the bundle has a McpBundle.directory and ui/app.json exists, read the full UI definition off disk via bundle.uiResourcesapp.json → application root, pages/*.json → page content.
  2. Embedded layout (fallback): when neither of the above conditions holds, fall back to the typed UiSection inside manifest.json. This path covers in-memory bundles and bundles constructed programmatically via the typed models.

Manifest-derived metadata (icon, splash, publisher.logo, screenshots) is handled identically in both paths — bundle:// URIs resolve through BundleAssetProvider.

Composes with BundleAssetProvider (which itself composes with BundleStoragePort) for bundle:// URI resolution.

Single-direction adapter: fromDefinition throws UnsupportedError.

Constructors

BundleUiReadAdapter({required BundleAssetProvider assetProvider})
Requires a BundleAssetProvider for resolving bundle:// URIs in icon, splash image, publisher logo, and screenshots fields.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

fromDefinition(Map<String, dynamic> definitionJson) Future<UiResult<UiWriteOutput>>
Write: Convert UI definition JSON into bundle-compatible sections.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toAppInfo(McpBundle bundle) Future<UiResult<Map<String, dynamic>>>
Read: Extract lightweight app info for discovery/listing.
toDefinition(McpBundle bundle) Future<UiResult<Map<String, dynamic>>>
Read: Convert McpBundle into runtime-consumable UI definition JSON.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited