CometChatCalls class
Main SDK class - Single source of truth for SDK state and business logic. All validation, state management, and business logic belongs here. The platform layer is used only for native communication.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- callAppSettings → CallAppSettings?
-
Returns the current CallAppSettings if initialized.
no setter
- isInitialized → bool
-
Checks if the CometChat Calls SDK is initialized.
no setter
- language → String?
-
Returns the language information if set.
no setter
- platform → String?
-
Returns the platform information if set.
no setter
- source → String?
-
Returns the source information if set.
no setter
Static Methods
-
addLoginListener(
String listenerID, LoginListener listener) → void - Adds a login listener with the specified listener ID. The listener will receive callbacks for login/logout events.
-
endSession(
{required dynamic onSuccess(String), required dynamic onError(CometChatCallsException)}) → void - Ends the current call session using the v4 API signature.
-
generateCallToken(
String sessionId, {required dynamic onSuccess(CallToken), required dynamic onError(CometChatCallsException)}) → void -
Generates a call token for the given
sessionId. -
generateToken(
String sessionId, String userAuthToken, {required dynamic onSuccess(GenerateToken), required dynamic onError(CometChatCallsException)}) → void -
Generates a call token for the given session ID using the provided
userAuthToken. -
getCallDetails(
String sessionId, {required dynamic onSuccess(List< CallLog> callLogs), required dynamic onError(CometChatCallsException)}) → void - Retrieves the call details for a given session ID. All validation is done here in the Dart layer using InputValidator.
-
getLoggedInUser(
) → Future< User?> - Retrieves the logged-in user from the CurrentUserRepository.
-
getPersistedAppId(
) → Future< String?> - Returns the persisted appId from preferences. Requirements: 1.5
-
getSDKPackageName(
) → String - Returns the SDK package name.
-
getSDKVersion(
) → String - Returns the SDK version string. Matches the version in pubspec.yaml.
-
getUserAuthToken(
) → Future< String?> - Retrieves the user auth token for the currently logged-in user.
-
init(
CallAppSettings callAppSettings, {required dynamic onSuccess(String), required dynamic onError(CometChatCallsException)}) → void -
Initializes the CometChat Calls SDK with the provided
callAppSettings. -
isConnectedToNetwork(
) → Future< bool> - Checks if the device is connected to a network. Returns true if connected to WiFi, mobile data, or ethernet.
-
joinSession(
{String? sessionId, CallToken? callToken, required SessionSettings sessionSettings, required dynamic onSuccess(Widget?), required dynamic onError(CometChatCallsException)}) → Future< void> -
Joins a call session using either a
sessionIdor a pre-generatedcallToken. -
joinSessionWithCallToken(
CallToken? callToken, SessionSettings? sessionSettings, Widget? container, dynamic onSuccess(Widget?), dynamic onError(CometChatCallsException)) → Future< void> - Joins a call session with the provided call token and SessionSettings.
-
login(
{required String uid, required String authKey, required dynamic onSuccess(User?), required dynamic onError(CometChatCallsException)}) → void - Logs in to the CometChat Calls SDK using the provided user ID and auth key. All validation and state management is done here in the Dart layer using InputValidator. Requirements: 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8
-
loginWithAuthToken(
{required String authToken, required dynamic onSuccess(User?), required dynamic onError(CometChatCallsException)}) → void - Logs in to the CometChat Calls SDK using the provided auth token. All validation and state management is done here in the Dart layer using InputValidator. Requirements: 2.1, 2.2, 2.3, 2.4, 2.6, 2.7, 2.8
-
logout(
{required dynamic onSuccess(String), required dynamic onError(CometChatCallsException)}) → void - Logs out of the CometChat Calls SDK. Clears all stored credentials and session data. Requirements: 2.8
-
removeLoginListener(
String listenerID) → void - Removes a login listener with the specified listener ID.
-
resetForTesting(
) → void - Resets the SDK state for testing purposes. This should only be used in tests.
-
setSource(
String resource, String platform, String language) → void - Sets the source information for analytics tracking.
-
startSession(
String callToken, CallSettings callSettings, {required dynamic onSuccess(Widget?), required dynamic onError(CometChatCallsException)}) → void - Starts a call session using the v4 API signature.