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('|');
  final direction = callDirection ?? ("incoming" == tokens[3].toLowerCase() ? CallDirection.incoming : CallDirection.outgoing);
  return ActiveCall(
    from: tokens[1],
    to: tokens[2],
    initiated: initiated ? DateTime.now() : null,
    callDirection: direction,
    customParams: parseCustomParams(tokens),
  );
}