addToScreen method

void addToScreen(
  1. String hostName,
  2. String screenId,
  3. DCFComponentNode content
)

Add content to a screen host

hostName - Target host identifier screenId - Unique identifier for this content (for replacement) content - The content node to teleport to the host

Implementation

void addToScreen(String hostName, String screenId, DCFComponentNode content) {
  if (!_screens.containsKey(hostName)) {
    _screens[hostName] = [];
  }

  // Remove existing content with same ID
  _screens[hostName]!.removeWhere((node) => node.key == screenId);

  // Add new content
  _screens[hostName]!.add(content);

  if (kDebugMode) {
    print('📺 ScreenManager: Added content "$screenId" to host "$hostName"');
    print('📺   Total content for host: ${_screens[hostName]!.length}');
    print('📺   Has callback registered: ${_hostCallbacks.containsKey(hostName)}');
  }

  // Notify host to update
  _hostCallbacks[hostName]?.call();
}