Home > Software design >  How to remove '0 in timer_count_down?
How to remove '0 in timer_count_down?

Time:11-11

I installed timer_count_down for my timer and when I use it, it showed me a text like this => 59.0

I need to remove .0, how can I do this?

This is how it looks like

And this is my Countdown:

Countdown(
  seconds: 60,
  interval: Duration(seconds: 1),
  build: (BuildContext context, double time) => Text(
    "00:${time.toString()}",
    style: const TextStyle(
      color: AppColors.gray9D9F9E
    ),
  ),
  onFinished: () {
    log("It is finished!");
    },
)

If it's impossible to remove that '0...what alternatives of this timer exist?

I got 00:59.0 but I need this => 00:59

CodePudding user response:

You can first convert it to an int, like this

"00:${time.toInt().toString()}",
  • Related