Let’s how to format a bigger amount of seconds to minutes and seconds.
String formatTime(int? seconds, bool pad) {
return (pad)
? "${(seconds! / 60).floor()}:${(seconds % 60).toString().padLeft(2, "0")}"
: (seconds! > 59)
? "${(seconds / 60).floor()}:${(seconds % 60).toString().padLeft(2, "0")}"
: seconds.toString();
}
The above function takes any kinds of seconds and converts it minutes and seconds( if more seconds are left over)
It also checks for if we want to return just minutes or seconds.