setSpeechEngineReady method

void setSpeechEngineReady(
  1. bool speechEngineReady()
)

Sets a callback which returns the speech engine ready status.

Set the speech engine activity status using this callback to avoid speech event conflicts. This logic is used by RouteTracker before new RouteTracker.onNewVoiceGuidance is raised to check if the speech engine is busy. If it is busy, it will postpone raising the voice guidance event until the next RouteTracker.trackLocation is called. Here is an example of how it can be used with a text-to-speech engine:

routeTracker.setSpeechEngineReady(() {
  return !TextToSpeech.isSpeaking;
});

Parameters:

  • speechEngineReady: A callback function that returns a bool indicating the readiness state of the speech engine.