RuntimeEngine class

The main runtime engine that manages the MCP UI Runtime lifecycle and coordinates all runtime services.

Mixed-in types

Constructors

RuntimeEngine({bool enableDebugMode = kDebugMode, RenderInspector? widgetWrapper})

Properties

actionHandler → ActionHandler
no setter
animationService → AnimationService
no setter
applicationDefinition → ApplicationDefinition?
no setter
appMetadata → ValueListenable<DslAppMetadata?>
Observable snapshot of the current application metadata (bundle metadata). value is null before initialize completes and whenever the runtime holds a non-application (page-only) DSL. Listeners fire whenever the cache is replaced — for example when ui://app/info emits a resource-update notification.
no setter
assetResolver ↔ AssetResolver
Asset resolution for every slot typed AssetRef.
getter/setter pair
backgroundServiceManager → BackgroundServiceManager
no setter
bindingEngine → BindingEngine
no setter
cache → CacheManager
no setter
cacheManager → CacheManager
no setter
capabilities ↔ RuntimeCapabilities
Behaviours this runtime can actually perform: sound, media decoding, a web engine, a tile source. Wired by the host exactly as assetResolver is. The default is RuntimeCapabilities.none — a runtime that performs none of them and says so, which is conformant; drawing a facsimile instead is not.
getter/setter pair
channelManager → ChannelManager
no setter
computedManager → ComputedManager
no setter
connectivityManager → ConnectivityManager
no setter
enableDebugMode → bool
final
entrySession → EntrySession
Entry and identity this runtime was opened under. Always present; empty until a host adopts an entry or an identity.
no setter
eventBus → EventBus
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isApplication → bool
no setter
isInitialized → bool
no setter
isReady → bool
no setter
lifecycle → LifecycleManager
no setter
mediaRegistry → MediaRegistry
Mounted media players, addressed by the id their document gave them for media actions. Lives on the engine because a media action runs from the action handler, which has no widget to search from.
final
Public getter for NavigationService
no setter
The navigator key for the MaterialApp this engine's document builds when it declares routes. One per engine — the key used to come from the NavigationService singleton, so two documents mounted at once put the same GlobalKey in two places and Flutter truncated the tree at the second: its page never appeared and the first was torn out of its parent. This is the collision the comment further down called "a separate refactor track"; it is what a second app on screen actually hits.
final
notifications → NotificationManager
no setter
offlineQueue → OfflineQueue
no setter
onResourceList → dynamic Function(String, String)?
Optional one-shot list callback. Null when the host did not register one; callers fall back to onResourceSubscribe.
no setter
onResourceRead → dynamic Function(String, String)?
Optional one-shot read callback. Null when the host did not register one; callers fall back to onResourceSubscribe.
no setter
onResourceSubscribe → dynamic Function(String, String)?
no setter
onResourceUnsubscribe → dynamic Function(String)?
no setter
parsedUIDefinition → UIDefinition?
no setter
permissionHandler ↔ Function?
Permission handler for custom permission prompts
getter/setter pair
permissionManager → PermissionManager?
Permission manager for runtime permission checks
no setter
pluginManager → PluginManager
no setter
renderer → Renderer
no setter
responsiveResolver → ResponsiveResolver
no setter
routeManager → RouteManager?
no setter
routeObserver → RouteObserver<ModalRoute<void>>
This engine's route observer — what feeds onPause / onResume for its pages. Per engine for the same reason as navigatorKey, and one more: a RouteObserver may be attached to a single navigator at a time, so a shared one trips observer.navigator == null the moment a second document mounts.
final
runtimeConfig → Map<String, dynamic>?
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
services → ServiceRegistry
no setter
stateManager → StateManager
no setter
syncManager → SyncManager
no setter
templateRegistry → TemplateRegistry
no setter
themeManager → ThemeManager
no setter
uiDefinition → Map<String, dynamic>?
no setter
widgetRegistry → WidgetRegistry
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
destroy() → Future<void>
Destroys the runtime and cleans up resources
dispose() → void
Discards any resources used by the object.
override
getBindingForUri(String uri) → String?
handleMCPNotification(Map<String, dynamic> params, {dynamic resourceReader(String)?}) → Future<void>
Handles MCP notification with automatic mode detection Supports both standard (URI only) and extended (URI + content) modes
handleNotification(String uri, Map<String, dynamic> data) → void
Handles MCP notification for resource updates
handleResourceNotification(String uri, Map<String, dynamic> data) → void
initialize({required Map<String, dynamic> definition, RenderContext? context, bool useCache = true, dynamic pageLoader(String)?, EntryContext? entry, IdentityContext? identity, String? launchRoute}) → Future<void>
Initializes the runtime engine with the provided configuration
loadPage(String route) → Future<void>
Loads a page by route using the registered page loader.
markReady() → Future<void>
Marks the runtime as ready and executes onReady lifecycle hooks
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
pause() → Future<void>
Handles application pause events
registerResourceSubscription(String uri, String binding) → void
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
resume() → Future<void>
Handles application resume events
setResourceHandlers({dynamic onResourceSubscribe(String, String)?, dynamic onResourceUnsubscribe(String)?, dynamic onResourceRead(String, String)?, dynamic onResourceList(String, String)?}) → void
toString() → String
A string representation of this object.
inherited
unregisterResourceSubscription(String uri) → void

Operators

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