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

With UIKitSettings.enableCalls, the UI Kit starts this itself at login (including a session restored by CometChatUIKit.init) and stops it at logout, and it follows a direct CometChat.login/logout too. It also initialises the Calls SDK and logs the user into it, within a time limit. Configure the call UI through UIKitSettings.callingConfiguration.

init and dispose remain for apps that manage calls themselves. Both are safe to call more than once:

// After login, when UIKitSettings.enableCalls is off.
await CallEventService.instance.init();

// To wait for the Calls SDK before a call, e.g. from a push handler.
await CallEventService.instance.waitForCallsSdk();
Mixed-in types

Properties

activeCall ↔ BaseMessage?
The call this device placed or answered, until it is over.
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
Answered here: the call stops ringing and becomes the active one.
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, then log the Calls SDK out.
init({CallingConfiguration? configuration}) → Future<void>
Starts call handling for the logged-in user: registers the call listeners (at once), then initialises the Calls SDK and logs the user into it (bounded; a failure is logged, never thrown, and retried once at the next waitForCallsSdk).
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
"Ongoing" for a call — delivered to every listener, whichever side this device is on and whichever call it is about.
override
onOutgoingCallRejected(Call call) → void
"Rejected" or "busy". For the call ringing here, while this device is not declining it, the same user declined it on another device (or it was bounced busy there): the banner goes with the record, so the two cannot disagree.
override
reinitializeAfterSession() → Future<void>
Makes sure the Calls SDK is still initialised and logged in after a call session.
toString() → String
A string representation of this object.
inherited
waitForCallsSdk() → Future<void>
Waits for the Calls SDK to be initialised and the logged-in user to be logged into it. Returns at once when it already is.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

instance → CallEventService
The service.
final