detach method
Detaches the portal if attached to a host.
Returns a future that completes when detached.
Implementation
Future<void> detach() {
final currentHost = _attachedHost;
assert(currentHost != null);
_attachedHost = null;
return currentHost!.detach();
}