getCallState function

int getCallState({
  1. required String stateValue,
})

Determines the call state from a string value.

This function maps a string representation of a call state to its corresponding integer value. It is used to convert JSON string values to the integer values expected by the application logic.

stateValue: The string representation of the call state.

Returns an integer representing the call state.

Implementation

int getCallState({required String stateValue}) {
  switch (stateValue) {
    case "MissedCall":
      return 0;
    case "OutgoingCall":
      return 1;
    case "IncomingCall":
      return 2;
    default:
      return 1;
  }
}