attachComponentPortal method

  1. @override
Future<ComponentRef<Object>> attachComponentPortal(
  1. ComponentPortal<Object> portal
)
override

Implementation

@override
Future<ComponentRef<Object>> attachComponentPortal(
    ComponentPortal<Object> portal) {
  // By default, use the portal host as the origin. If [portal.origin] is set
  // however, then use that.
  ViewContainerRef? viewContainerRef = _viewContainerRef;
  if (portal.origin != null) {
    viewContainerRef = portal.origin;
  }
  final ref = _componentLoader.loadNextToLocation(
      portal.componentFactory, viewContainerRef!);
  setPortalDisposer(ref.destroy);
  // TODO(google): This is no longer async remove the future if possible.
  return Future.value(ref);
}