CallEventService class
Singleton service that manages global call SDK event listeners with proper lifecycle (init/dispose).
Centralizes all call-related SDK listener handling:
- Incoming call received → shows IncomingCallOverlay
- Outgoing call accepted/rejected → navigates or cleans up
- Call ended → clears active call state
- Updates CallStateService for global call state tracking
Usage:
// Initialize after login
CallEventService.instance.init(configuration: callingConfig);
// Dispose on logout
CallEventService.instance.dispose();
- Mixed-in types
Properties
- activeCall ↔ BaseMessage?
-
The currently active call, tracked for state management.
getter/setter pair
- cachedAuthToken → String?
-
Returns the cached user auth token, or null if not yet fetched.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isCallsSdkReady → bool
-
Returns true if the Calls SDK has been initialized successfully.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
ccCallAccepted(
Call call) → void -
ccCallAccepted is used to inform the listeners that a call is accepted by the logged-in user.
override
-
ccCallEnded(
Call call) → void -
ccCallEnded is used to inform the listeners that a call is ended by either the logged-in user.
override
-
ccCallRejected(
Call call) → void -
ccCallRejected is used to inform the listeners that a call is rejected by the logged-in user.
override
-
ccOutgoingCall(
Call call) → void -
ccOutgoingCall is used to inform the listeners that an outgoing call is initiated by the logged-in user.
override
-
dispose(
) → void - Remove all SDK listeners and reset state. Resets the Calls SDK initialization and login state so that the next init() call will re-initialize and re-login the Calls SDK. This is necessary for the logout → re-login flow: the Chat SDK logout clears the native Calls SDK state, so we must re-init on next login.
-
init(
{CallingConfiguration? configuration}) → Future< void> - Initialize the service: cache logged-in user, register SDK listeners, and initialize the Calls SDK. Safe to call multiple times — will no-op if already initialized.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onCallEndedMessageReceived(
Call call) → void -
override
-
onIncomingCallCancelled(
Call call) → void -
override
-
onIncomingCallReceived(
Call call) → void -
override
-
onOutgoingCallAccepted(
Call call) → void -
override
-
onOutgoingCallRejected(
Call call) → void -
override
-
reinitializeAfterSession(
) → Future< void> - Re-initializes the Calls SDK after a session ends. Per the V5 SDK sample app: "The SDK's internal state can get cleared after a session, so this ensures subsequent calls work properly."
-
toString(
) → String -
A string representation of this object.
inherited
-
waitForCallsSdk(
) → Future< void> - Waits for the Calls SDK to be ready AND the user to be logged in. If already ready, returns immediately. Other components (e.g. CallLogsBloc, VoipCallHandler) should call this instead of initializing the SDK themselves.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → CallEventService
-
final