'How can i remove unwanted extra double values from timer

i have the following duration result

0:00:01.110000

and i am trying to make it look like following , one for minute and one for seconds .. single digit minutes since my case don't require more than 9 minutes

0:01 

the problem i can't control the source of duration because it comes from plugin i use , and i need to handle it in Text widget with the previous patron

duration myResulDuration  = 0:00:01.110000;
Text(myResulDuration.toString()),

outouts : 0:00:01.110000

wanted result is 0:01 

How can i achieve with this ?



Solution 1:[1]

Write a function that gives two digits of formatted data

String twoDigits(int n) => n.toString().padLeft(2, '0');
final minutes = twoDigits(myResultTimer.inMinutes.remainder(60));
final seconds = twoDigits(myResultTimer.inSeconds.remainder(60));

show these minutes and seconds in Text Widget

Text(''$minutes:$seconds')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 nagendra nag