CallUtils class

CallUtils is a utility class that contains methods to perform call related operations.

A call is missed when it went unanswered or was cancelled, for the person who did not start it. One rule drives the call bubbles' text, icon and colour, isMissedCall, the call logs and the Chats list: a rejected or busy call is never missed and reads the same on both sides. (The chat SDK gives realtime and history call messages the user who acted as callInitiator, the callee who declined, say; only the statuses the caller sends say reliably who started a call.)

Constructors

CallUtils()

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 Methods

callLogLoggedInUser(CallLog? callLog, User? loggedInUser) → bool
Returns true if the call is initiated by the logged in user.
getCallIcon(BuildContext context, CallLog callLog, User? loggedInUser, CometChatColorPalette colorPalette, CometChatTypography typography, CometChatSpacing spacing, CometChatCallLogsStyle style, {Widget? incomingCallIcon, Widget? outgoingCallIcon, Widget? missedCallIcon}) → Widget
getCallIcon Return call status icon: the missed icon for a missed call (isMissedCallLog), otherwise outgoing or incoming by direction, whatever the status.
getCallIconByStatus(BuildContext context, BaseMessage baseMessage, User? loggedInUser, bool isAudio) → String
The icon asset of a call action bubble: the missed glyph for a missed call (see isMissedCall), a direction glyph while a call is initiated, and the plain call glyph for every other status.
getCallIconColor(BuildContext context, BaseMessage baseMessage, User? loggedInUser, CometChatColorPalette colorPalette) → Color
The colour of a call icon: the error colour for a missed call (see isMissedCall), iconSecondary otherwise. The call action bubbles paint their icon with getCallTextColor instead, so it matches their text.
getCallStatus(BuildContext context, BaseMessage baseMessage, User? loggedInUser) → String
Returns the call status message: the text of a call action bubble, after a leading space.
getCallStatusColor(CallLog callLog, User? loggedInUser, CometChatColorPalette colorPalette) → Color
getCallStatusColor returns call status color: the error colour for a missed call (isMissedCallLog), textPrimary for every other one.
getCallTextColor(BuildContext context, BaseMessage baseMessage, User? loggedInUser, CometChatColorPalette colorPalette) → Color
The colour of a call action bubble's text, and of its icon: the error colour for a missed call (see isMissedCall), textSecondary otherwise.
getLastMessageForGroupCall(BaseMessage lastMessage, BuildContext context, User? loggedInUser) → String
getStatus(BuildContext? context, CallLog? callLog, User? loggedInUser) → String
getStatus return call status: the label of a call-log row, after a leading space. A missed call (isMissedCallLog) reads "Missed Call"; otherwise an initiated or ended call reads by direction, an ongoing one "Ongoing call", an unanswered or cancelled one (yours) "Unanswered Call" or "Cancelled Call", and a rejected or busy one "Call rejected" or "Call busy" on both sides. A missing log, user or context gives the empty string.
isAudioCall(CallLog callLog) → bool
isCallInitiatedByMe(Call call) → bool
isLoggedInUser(User? initiator, User? loggedInUser) → bool
Returns true if the call is initiated by the logged in user.
isMissedCall(Call call, User? loggedInUser) → bool
isMissedCall returns true if call is a missed call for loggedInUser: a 1:1 call that went unanswered or was cancelled, which loggedInUser did not start. A rejected or busy call is never missed.
isMissedCallLog(CallLog? callLog, User? loggedInUser) → bool
isMissedCallLog returns true if callLog is a missed call for loggedInUser: one that went unanswered or was cancelled, which loggedInUser did not start (as callLogLoggedInUser reads it). A rejected or busy call is never missed. The call logs' icon (getCallIcon), title colour (getCallStatusColor) and label (getStatus) all follow it, as the call bubbles follow isMissedCall.
isVideoCall(Call call) → bool
Returns true if the call is a video call.