I am developing a flutter application in which I am using Mapbox to add turn-by-turn navigation. I have been looking at some tutorials to add markers to the map. However, I also want to give the user awareness of these specific points through voice output. Is it possible to achieve this objective? Any resources or advice that you could provide, please?

Edit: How can I integrate the text to speech with the custom mapbox on my flutter app? For the Mapbox, we simply run the following code to enable voice instructions.

voiceInstructionsEnabled: true,

So how can I add the text conversion with it?

Truly appreciate any help


Solution 1: Deepak Joshi

You can do it separately.

You can show markers on map with Mapbox and prepare a string with all marker labels and use flutter_tts package to convert to speech as follows:

Future _speak() async {
await flutterTts.setVolume(volume);
await flutterTts.setSpeechRate(rate);
await flutterTts.setPitch(pitch);

if (_newVoiceText != null) {
  if (_newVoiceText!.isNotEmpty) {
    await flutterTts.speak(_newVoiceText!);
  }
}

}

This snippet is taken from the example given in documentation: https://pub.dev/packages/flutter_tts/example