ScheduledTimer class
A simple timer that can be scheduled to run at a specific time.
Constructors
- ScheduledTimer({required String id, required VoidCallback onExecute, DateTime? defaultScheduledTime, VoidCallback? onMissedSchedule})
- Creates a new ScheduledTimer.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String?
-
A string identifying this timer. Used to store and retrieve the scheduled time across app restarts.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scheduledTime → DateTime?
-
The scheduled time of execution. Will return
null
if no time is scheduled.no setter
Methods
-
clearSchedule(
) → void - Stop the timer and clear any scheduled execution time.
-
execute(
) → void - Manually execute the timer function.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
schedule(
DateTime scheduledTime) → void -
start(
) → void -
Start the timer if it was stopped. It's not necessary to call
start()
manually if you didn't previously stop the timer - the timer will be started automatically after it is created. -
stop(
) → void - Stop the timer if it's running.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited