setStatus method

  1. @override
void setStatus(
  1. ChatStatus status
)
override

Implementation

@override
void setStatus(ChatStatus status) {
  // Preventing unnecessary calls.
  // Old status is the same as the new status.
  //
  // We allow "idle" because in certain cases, the UI might not update when
  // trying to exit voice mode.
  if (status == _oldStatus && ChatStatus.idle != status) {
    return;
  }

  // Preventing the status from going back to speaking from answering.
  if (_oldStatus == ChatStatus.speaking && status == ChatStatus.answering) {
    return;
  }

  _oldStatus = status;
  _setStatus(status);
}