attach method

Future attach(
  1. PortalHost? host
)

Attaches the portal within host.

Returns a future that completes with an instance of the portal's instance.

Throws StateError if a portal is already attached.

Implementation

Future<dynamic /*ComponentRef<Object> | Map<String, dynamic>*/ > attach(
    PortalHost? host) {
  assert(host != null);
  if (isAttached) {
    throw StateError('Already attached to host!');
  } else {
    _attachedHost = host;
    return host?.attach(this) as Future<T>;
  }
}