CountdownTimerProvider class
Provider for managing countdown timer state across the app
- Inheritance
-
- Object
- ChangeNotifier
- CountdownTimerProvider
Constructors
Properties
- config → CountdownConfig?
-
Current configuration
no setter
- elapsed → Duration
-
Time elapsed
no setter
- errorMessage → String?
-
Error message if any
no setter
- formattedElapsed → String
-
Formatted elapsed time
no setter
- formattedTime → String
-
Formatted remaining time string
no setter
- hasError → bool
-
Whether there's an error
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isActive → bool
-
Whether the timer is active (running or paused)
no setter
- isCritical → bool
-
Check if timer is in critical state (less than 5% remaining)
no setter
- isFinished → bool
-
Whether the timer has finished
no setter
- isPaused → bool
-
Whether the timer is paused
no setter
- isRunning → bool
-
Whether the timer is currently running
no setter
- isVisible → bool
-
Whether the timer should be visible
no setter
- isWarning → bool
-
Check if timer is in warning state (less than 10% remaining)
no setter
- percentageRemaining → double
-
Percentage remaining (0 to 100)
no setter
- progress → double
-
Progress value (0.0 to 1.0)
no setter
- remaining → Duration
-
Current remaining time
no setter
- remainingHours → int
-
Get time remaining in different units
no setter
- remainingMilliseconds → int
-
no setter
- remainingMinutes → int
-
no setter
- remainingSeconds → int
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → String
-
Get timer status as a string
no setter
- totalDuration → Duration
-
Total duration of the timer
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
addTime(
Duration additionalTime) → void - Add time to the current timer
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
override
-
hideTimer(
) → void - Hide the timer without stopping it
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
pauseTimer(
) → void - Pause the current timer
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
resetTimer(
) → void - Reset the timer to its original duration
-
resumeTimer(
) → void - Resume the paused timer
-
setOnErrorCallback(
void callback(String error)) → void - Set a custom callback for errors
-
setOnFinishCallback(
VoidCallback callback) → void - Set a custom callback for when the timer finishes
-
setOnTickCallback(
void callback(Duration remaining)) → void - Set a custom callback for every tick
-
setRemainingTime(
Duration time) → void - Set remaining time directly
-
showTimer(
) → void - Show the timer if it was hidden
-
startTimer(
{required Duration duration, VoidCallback? onFinish, VoidCallback? onPause, VoidCallback? onResume, VoidCallback? onReset, void onTick(Duration remaining)?, void onError(String error)?, Duration interval = const Duration(seconds: 1), bool autoStart = true}) → void - Start a countdown timer
-
startTimerWithConfig(
CountdownConfig config) → void - Start timer with configuration
-
stopTimer(
) → void - Stop the current timer
-
subtractTime(
Duration timeToSubtract) → void - Subtract time from the current timer
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited