changePauseFor method
Call this while listen is active to change the pauseFor duration. This will restart the timer for the new duration. It is useful for allowing a long first pause then dynamically shortening it once the user starts speaking.
Implementation
void changePauseFor(Duration pauseFor) {
//Setup new pauseFor only if listen is active and pauseFor is different
if (isNotListening) {
throw ListenNotStartedException();
}
if (_pauseFor != pauseFor) {
_listenTimer?.cancel();
_listenTimer = null;
// ignoreElapsePause ensures that the timer waits for the full pauseFor
// duration before stopping the listen
_setupListenAndPause(pauseFor, _listenFor, ignoreElapsedPause: true);
}
}