Stream<PortalEventData>.
Overview
Portal emits events for connection state, chain changes, signing requests, dApp sessions, and more. Use these events to:- Drive UI for
autoApprove: falseflows — show approval prompts when the SDK requests a signature. - React to chain switches initiated by a connected dApp.
- Track WalletConnect / Portal Connect session lifecycle.
- Build progress and audit logging across native MPC operations.
Stream on the Portal singleton:
.where(...), listen with .listen(...), await one-shot with .firstWhere(...), and stop listening by cancelling the returned StreamSubscription. Listeners are kept across Portal.initialize() calls so apps can subscribe at startup.
Subscribing to events
Listen to all events
Filter by event type
Use thePortalEvent enum to filter the stream to a single event:
One-shot (await a single event)
Multiple subscribers
Becauseportal.events is a broadcast stream, you can attach as many subscribers as you need without one consuming the events for the others:
Event types
portal.events delivers PortalEventData — a small wrapper that carries the raw event name, the matching PortalEvent enum value (when known), and the JSON-decoded payload from the native side.
data field’s shape depends on the event — most events carry a Map<String, dynamic> decoded from the native JSON payload.
PortalEvent enum
If the native SDK ever dispatches an event the Flutter SDK does not yet recognize,
PortalEventData.event will be null while name and data are still populated — listeners can still log or react to the raw name without breaking.
Emitting events back to the native SDK
For bidirectional flows — most importantly approving or rejecting a pending signing request whenautoApprove: false — use portal.emit(...):
PortalEvent.portalSigningRequested when user approval is needed; the host inspects the request, surfaces UI, and emits portalSigningApproved (or portalSigningRejected) to let the original signing call resolve.
data is JSON-encoded before being sent across the platform channel — pass primitives, Maps, or Lists (anything jsonEncode accepts).