TimeUtils class abstract
A utility class that provides helper methods for working with time.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
compareExecutionTimes(
{required FutureOr< void> taskA(), required FutureOr<void> taskB()}) → Future<(Duration, Duration)> - Compares the execution durations of two tasks, accommodating both synchronous and asynchronous operations.
-
debounce(
FutureOr< void> func(), Duration duration, {Duration? maxWait, bool immediate = false, String? debugLabel}) → DebouncedCallback -
Creates a debounced callback that delays the execution of
funcuntildurationhas passed since the last time it was invoked. -
executionDuration(
FutureOr< void> task()) → Future<Duration> - Calculates the execution duration of a task, accommodating both synchronous and asynchronous operations.
-
executionDurations(
List< FutureOr< tasks) → Future<void> Function()>List< Duration> > - Measures the execution time for a list of tasks, whether synchronous or asynchronous.
-
runPeriodically(
{required Duration interval, required void onExecute(Timer timer, int count)}) → Timer - Executes a function periodically with the given interval.
-
runWithTimeout<
T> ({required FutureOr< T> task(), required Duration timeout}) → Future<T> - Executes a function with a timeout.
-
throttle(
void func(), Duration interval, {bool leading = true, bool trailing = false, ThrottlerErrorHandler? onError}) → ThrottledCallback -
Creates a throttled callback that invokes
funcat most once perinterval.