isolate_timer 1.0.0+1 copy "isolate_timer: ^1.0.0+1" to clipboard
isolate_timer: ^1.0.0+1 copied to clipboard

A simple timer logic running in an isolate. Built with BLoC.

A simple timer logic running in an isolate. Built with BLoC.

Getting started #

This package provides a BLoC cubit that manage a timer running inside an isolate.

Usage #

// creates a TimerCubit that will run from startTime to finishTime
final startTime = DateTime(2024, 11, 20, 10);
final finishTime = DateTime(2024, 11, 20, 10, 0, 50);
final timerCubit = TimerCubit(startTime, finishTime);

// creates a timer that will run from now and will last the given duration
final durationTimerCubit = TimerCubit.duration(Duration(minutes: 5));

// get the total duration of the timer
print(timerCubit.maxDuration);

// restarts the timer
timerCubit.reset();

// displays a duration in a mm:ss format
print(durationToMinutes(Duration(minutes: 3, seconds: 20))); // '03:20'
1
likes
140
points
7
downloads

Publisher

verified publishercaelis-tech.studio

Weekly Downloads

A simple timer logic running in an isolate. Built with BLoC.

Repository (GitHub)
View/report issues

Topics

#bloc #timer #countdown

Documentation

API reference

License

MIT (license)

Dependencies

bloc, equatable

More

Packages that depend on isolate_timer