createCallFromState function

ActiveCall createCallFromState(
  1. String state, {
  2. CallDirection? callDirection,
  3. bool initiated = false,
})

Implementation

ActiveCall createCallFromState(String state,
    {CallDirection? callDirection, bool initiated = false}) {
  List<String> tokens = state.split('|');
  return ActiveCall(
      from: tokens[1],
      to: tokens[2],
      initiated: initiated ? DateTime.now() : null,
      callDirection: callDirection ??
          ("Incoming" == tokens[3]
              ? CallDirection.incoming
              : CallDirection.outgoing),
      customParams: parseCustomParams(tokens));
}