Hello how are you?
I'm having difficulties in getting the time conversion of the route returned by the library that is returned by "road.duration" right.
I have done so to convert
ValueNotifier<String> tempoRota = ValueNotifier('00:00');
However, it always gives me a value in hours, and depending on the length of the route, it doesn't give me the right travel time. So it only works for short routes. Routes that are longer in duration do not work.
Hello how are you? I'm having difficulties in getting the time conversion of the route returned by the library that is returned by "road.duration" right.
I have done so to convert
ValueNotifier<String> tempoRota = ValueNotifier('00:00');
Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Text( tempoRota.value, style: TextStyle(fontSize: 30), ), ], ),
tempoRota.value = getStringToTime(road.duration);
`String getStringToTime(double valor) { if (valor < 0) return 'Tempo inválido';
}
String getMinuteString(double decimalValue) { return '${(decimalValue / 60).toInt()}'.padLeft(2, '0'); }
String getHourString(int flooredValue) { return '${flooredValue % 24}'.padLeft(2, '0'); } `
However, it always gives me a value in hours, and depending on the length of the route, it doesn't give me the right travel time. So it only works for short routes. Routes that are longer in duration do not work.