isActive property

bool get isActive

Whether the timer is still active and waiting to fire.

Returns true if the timer has not yet fired (for one-time timers) or has not been cancelled (for periodic timers).

Returns false if the timer has completed or been cancelled.

Example:

final timer = Timer(Duration(seconds: 5), () => print('Done'))
    .withLifecycle(this);

print(timer.isActive); // true

timer.cancel();
print(timer.isActive); // false

Implementation

bool get isActive => _timer.isActive;