toTimeUnit method
Formats the integer as a two-digit time unit for playback duration (MM or SS).
Ensures that single-digit values are zero-padded (e.g., 5
→ "05"
, 12
→ "12"
).
Returns a string representation of the integer in a two-digit format.
Implementation
String toTimeUnit() {
String numberStr = toString();
return this < 10 ? '0$numberStr' : numberStr;
}